Re: [X2serv-cvs] CVS: x2/source parse.c,1.71,1.72
Brought to you by:
sirvulcan
From: Alex <ru...@bl...> - 2002-02-22 00:45:15
|
its tested now.. On Thu, 21 Feb 2002, Alex Schumann wrote: > Update of /cvsroot/x2serv/x2/source > In directory usw-pr-cvs1:/tmp/cvs-serv7791/source > > Modified Files: > parse.c > Log Message: > Replaced m_join() with one john wrote, which solves a bug when doing > /join 0,#achannelyouwerein. Since mine parsed backwards it caused problems. > This is not yet tested (: > > > Index: parse.c > =================================================================== > RCS file: /cvsroot/x2serv/x2/source/parse.c,v > retrieving revision 1.71 > retrieving revision 1.72 > diff -C2 -r1.71 -r1.72 > *** parse.c 7 Feb 2002 11:28:33 -0000 1.71 > --- parse.c 22 Feb 2002 00:35:22 -0000 1.72 > *************** > *** 470,513 **** > } > /* JOIN */ > int m_join(M_PARAMS) > { > ! int i; > ! char *channel; > > ! channel = (char *) strtok(rest, " "); > ! if(!channel) > ! { > ! Debug(DBGWARNING, "Invalid JOIN syntax (null channel)."); > ! return(0); > ! } > ! /* Need to check for comma seperated channels */ > ! for(i=strlen(channel)-2;i>=0;i--) > ! {/* move right to left.. call ProcessJoin when we hit a comma or beginning */ > ! if(channel[i] == ',') > ! { > ! ChannelListType cptr; > ! cptr = GetChannel(&channel[i+1]); > ! if(!strcmp(&channel[i+1], "0")) > ! { > ! RemoveNickFromAllChannels(uptr); > ! } > ! else > ! { > ! ProcessJoin(cptr, uptr, &channel[i+1], 'J', NetTime()); > ! } > ! channel[i] = '\0'; > ! } > ! } > ! if(!strcmp(channel, "0")) > { > ! /* JOIN 0 means part all join'd channels. */ > ! RemoveNickFromAllChannels(uptr); > } > ! else > { > ! ProcessJoin(GetChannel(channel), uptr, channel, 'J', NetTime()); > } > - return(0); > } > > /* Copied this from ircu. Since they were so nice to provide this > --- 470,554 ---- > } > /* JOIN */ > + /* Replacing with john_z's version > + *int m_join(M_PARAMS) > + *{ > + * int i; > + * char *channel; > + * > + * channel = (char *) strtok(rest, " "); > + * if(!channel) > + * { > + * Debug(DBGWARNING, "Invalid JOIN syntax (null channel)."); > + * return(0); > + * } > + * * Need to check for comma seperated channels * > + * for(i=strlen(channel)-2;i>=0;i--) > + * {* move right to left.. call ProcessJoin when we hit a comma or beginning * > + * if(channel[i] == ',') > + * { > + * ChannelListType cptr; > + * cptr = GetChannel(&channel[i+1]); > + * if(!strcmp(&channel[i+1], "0")) > + * { > + * RemoveNickFromAllChannels(uptr); > + * } > + * else > + * { > + * ProcessJoin(cptr, uptr, &channel[i+1], 'J', NetTime()); > + * } > + * channel[i] = '\0'; > + * } > + * } > + * if(!strcmp(channel, "0")) > + * { > + * * JOIN 0 means part all join'd channels. * > + * RemoveNickFromAllChannels(uptr); > + * } > + * else > + * { > + * ProcessJoin(GetChannel(channel), uptr, channel, 'J', NetTime()); > + * } > + * return(0); > + *} > + */ > + > + /* John_z's (of asylumnet) improved join handling function */ > int m_join(M_PARAMS) > { > ! char chan[100], *channels; > ! int i = 0, j = 0; > > ! channels = strtok(rest, " "); > ! if(!channels) > { > ! Debug(DBGWARNING, "Invalid JOIN syntax (null channel)."); > ! return(0); > } > ! > ! while(1) > { > ! if(channels[j] == '0') > ! { > ! if(j == 0 || channels[j-1] == ',') > ! { > ! RemoveNickFromAllChannels(uptr); > ! } > ! } > ! if(channels[j] == ',' || channels[j] == '\0') > ! { > ! chan[i] = '\0'; > ! ProcessJoin(GetChannel(chan), uptr, chan, 'J', NetTime()); > ! i = 0; > ! if(channels[j] == '\0') return(1); > ! } > ! else > ! { > ! chan[i] = channels[j]; > ! i++; > ! } > ! j++; > } > } > + > > /* Copied this from ircu. Since they were so nice to provide this > > > _______________________________________________ > X2serv-cvs mailing list > X2s...@li... > https://lists.sourceforge.net/lists/listinfo/x2serv-cvs > |