[X2serv-cvs] [CVS] Module x2: Change committed
Brought to you by:
sirvulcan
From: Alex S. <ru...@us...> - 2005-06-06 22:17:54
|
Committer : Alex Schumann <ru...@us...> CVSROOT : /cvsroot/x2serv Module : x2 Commit time: 2005-06-06 22:17:47 UTC Modified files: source/chan.c source/commands.c Log message: Adding the afternet mambo web based channel registration tool to tools/ ---------------------- diff included ---------------------- Index: x2/source/chan.c diff -u x2/source/chan.c:1.92 x2/source/chan.c:1.93 --- x2/source/chan.c:1.92 Sat Feb 19 19:43:08 2005 +++ x2/source/chan.c Mon Jun 6 15:17:35 2005 @@ -264,7 +264,8 @@ HandleListType FindBestUserMatch(ChannelListType cptr, UserListType uptr) { - char Str[LINEBUFFSIZE]; + char* Str; + char* Str2; int weight, prevweight = 0, lvl, prevlvl = 0; HandleListType hptr; MaskListType mptr; @@ -292,13 +293,17 @@ } } /* No login, so find a match here... */ + Str = (char *) malloc(strlen(uptr->Nick) + strlen(ActiveUsername(uptr)) + strlen(ActiveHost(uptr)) + 3); + Str2 = (char *) malloc(strlen(uptr->Nick) + strlen(uptr->UserID) + strlen(uptr->Address) + 3); + sprintf(Str, "%s!%s@%s", uptr->Nick, ActiveUsername(uptr), ActiveHost(uptr)); + sprintf(Str2, "%s!%s@%s", uptr->Nick, uptr->UserID, uptr->Address); for(hptr = cptr->Handles;hptr;hptr = hptr->Next) { for(mptr = hptr->Masks;mptr;mptr = mptr->Next) { - if (!matches(mptr->Mask, Str)) - { /* If mask matches our user, */ + if (!matches(mptr->Mask, Str) && !matches(mptr->Mask, Str2)) + { /* If mask matches our user by either 2 hosts above, */ weight=calcmaskweight(mptr->Mask); lvl=userlevelbychar(hptr->Level); if ( (!PrevHandlePtr || (lvl > prevlvl) || (weight > prevweight && lvl >= prevlvl))) @@ -311,6 +316,8 @@ } } return(PrevHandlePtr); + free(Str); + free(Str2); return(NULL); } Index: x2/source/commands.c diff -u x2/source/commands.c:1.191 x2/source/commands.c:1.192 --- x2/source/commands.c:1.191 Sun Mar 13 14:24:06 2005 +++ x2/source/commands.c Mon Jun 6 15:17:36 2005 @@ -1152,62 +1152,67 @@ * to do this there... and that file gives me a headache.. so.. -Rubin */ ptr = newrest; - while(*rest && ptr < newrest+MAXLEN-1) { - switch(*rest) { - case '1': case '2': - case '3': case '4': - case '5': case '6': - case '7': case '8': - case '9': case '0': - lastNumber = true; - if(lastBracket == true) { - *ptr = '*'; - ptr++; - } - *ptr = *rest; - lastBracket = false; - break; - case ')': case ']': /* Support sin[12](3) also */ - lastNumber = true; - lastBracket = true; - *ptr = *rest; - break; - case '(': case '[': - if (lastNumber == true) { - *ptr = '*'; - ptr++; - } - *ptr = *rest; - lastNumber = false; - lastBracket = false; - break; - default: - if(isalpha(*rest)) - { - if(lastNumber == true) { + while(*rest && ptr < newrest+MAXLEN-1) + { + switch(*rest) + { + case '1': case '2': + case '3': case '4': + case '5': case '6': + case '7': case '8': + case '9': case '0': + lastNumber = true; + if(lastBracket == true) + { + *ptr = '*'; + ptr++; + } + *ptr = *rest; + lastBracket = false; + break; + case ')': case ']': /* Support sin[12](3) also */ + lastNumber = true; + lastBracket = true; + *ptr = *rest; + break; + case '(': case '[': + if (lastNumber == true) + { *ptr = '*'; ptr++; } - } - *ptr = *rest; - lastNumber = false; - lastBracket = false; - break; + *ptr = *rest; + lastNumber = false; + lastBracket = false; + break; + default: + if(isalpha(*rest)) + { + if(lastNumber == true) + { + *ptr = '*'; + ptr++; + } + } + *ptr = *rest; + lastNumber = false; + lastBracket = false; + break; + } + rest++; + ptr++; } - rest++; - ptr++; - } - *ptr = '\0'; - do_math(buff, newrest); - if(said_inptr && PublicReplyAllowed(hptr)) - { - send_to_channel(said_inptr, "\002%s:\002 %s", uptr->Nick, buff); - } - else - { - send_to_user(uptr, "%s", buff); - } - return(TRUE); + *ptr = '\0'; + do_math(buff, newrest); + if(said_inptr && PublicReplyAllowed(hptr)) + { + send_to_channel(said_inptr, "\002%s:\002 %s", uptr->Nick, buff); + } + else + { + send_to_user(uptr, "%s", buff); + } + return(TRUE); } int c_inviteme(C_PARAM) ----------------------- End of diff ----------------------- |