[IRCServices] Feature request about nickname links and a sort of bug report

Milko Krachounov milko at milko.zon3x.net
Sun Nov 24 16:00:01 PST 2002


Currently, with the new linking module you can link only unregistered nick
to your nick. That's nice, but if there are people who have already
registered their nicks and now want to link them without reseting their
"Time registered" there is no way for them to do it. I run services in a
small network and it's not a problem for me to export the database to XML,
link the nicks by hand and then import the XML, but I think adding a little
feature which does this thing would be nice...

For example:
/ns link nickname2
This will link a non-registered nickname...
/ns link nickname2 password
If the nickname2 is registered (and this is the correct password for its
nickgroup ;P) and it is main in its nick group all nicks, channels, memos
will be moved from the nickname2's group to your group, if it is NOT the
main nick in its group, only nickname2 will be moved to your group.

/ns unlink nickname2 drops the linked nickname.
/ns unlink nickname2 password creates a new nickgroup with nickname2 in
it...

............................

I was the trying to write the above myself (it worked, but the server
segfaulted 2-3 minutes after use of these feautres, even though after XML
export of the database everything looked OK) and I noticed something that
looks like a bug in the oldlink.c:

/* Check for exceeding the per-email nick registration limit. */
if (NSRegEmailMax && target_ngi->email && !is_services_admin(u)
    && abs(n=count_nicks_with_email(target_ngi->email)) >= NSRegEmailMax
   ) {
        notice_lang(s_NickServ, u, NICK_LINK_TOO_MANY_NICKS, n,
                    NSRegEmailMax);
        return;
     }

The above checks whether currently the nicknames registered with
target_ngi's email haven't reached the maximum nicknames with the same email
allowed, but this will work fine if ngi contains only ONE nick, if it
contains more than one nick a user may be able to link a group with 30 nicks
(currently with another email set), to another group with say 50 nicks, the
result will be 80 nicks with the same email, even if the limit is set to
something less than 80... I think it will work that way:

if (NSRegEmailMax && target_ngi->email && !is_services_admin(u)
   && abs(n=count_nicks_with_email(target_ngi->email)) >= NSRegEmailMax
   && irc_stricmp(ngi->email, target_ngi->email) == 0) {
        notice_lang(s_NickServ, u, NICK_LINK_TOO_MANY_NICKS, n,
                    NSRegEmailMax);
        return;
     } else if (NSRegEmailMax && target_ngi->email && !is_services_admin(u)
   && abs(n=count_nicks_with_email(target_ngi->email))
   +  ngi->nicks_count >= NSRegEmailMax
   && irc_stricmp(ngi->email, target_ngi->email) != 0) {
        notice_lang(s_NickServ, u, NICK_LINK_TOO_MANY_NICKS, n,
                    NSRegEmailMax);
        return;
    }

(I'm not very good in writing C sources, so I don't guarantee that the above
will work :) )

.....................

I just notice request from Craig Edwards about the ability to DROP linked
nick without droping the whole nickgroup... I think it is a good idea, but
for the DROPNICK feature, as I may want to drop some of someone's linked
nickname, but not his WHOLE nickname group...

Sorry for puting all these things in same place...