X-Git-Url: https://jfr.im/git/irc/quakenet/newserv.git/blobdiff_plain/7839f73a60770f2e3d8bc97ff1c3d709985a7203..9d4541acd3fa4962bd0a17ff8b09c0373c465e1d:/channel/channelhandlers.c diff --git a/channel/channelhandlers.c b/channel/channelhandlers.c index 49d6c154..19faac26 100644 --- a/channel/channelhandlers.c +++ b/channel/channelhandlers.c @@ -212,7 +212,7 @@ int handleburstmsg(void *source, int cargc, char **cargv) { int handlejoinmsg(void *source, int cargc, char **cargv) { char *pos,*nextchan; nick *np; - void *harg[2]; + void *harg[3]; channel *cp,**ch; long timestamp=0; int i; @@ -230,7 +230,7 @@ int handlejoinmsg(void *source, int cargc, char **cargv) { /* Find out who we are talking about here */ np=getnickbynumericstr(source); if (np==NULL) { - Error("channel",ERR_WARNING,"Channel join from non existent user %s",source); + Error("channel",ERR_WARNING,"Channel join from non existent user %s",(char *)source); return CMD_OK; } @@ -325,7 +325,7 @@ int handlecreatemsg(void *source, int cargc, char **cargv) { /* Find out who we are talking about here */ np=getnickbynumericstr(source); if (np==NULL) { - Error("channel",ERR_WARNING,"Channel create from non existent user %s",source); + Error("channel",ERR_WARNING,"Channel create from non existent user %s",(char *)source); return CMD_OK; } @@ -408,7 +408,7 @@ int handlepartmsg(void *source, int cargc, char **cargv) { /* Find out who we are talking about here */ np=getnickbynumericstr(source); if (np==NULL) { - Error("channel",ERR_WARNING,"PART from non existent numeric %s",source); + Error("channel",ERR_WARNING,"PART from non existent numeric %s",(char *)source); return CMD_OK; } @@ -455,7 +455,7 @@ int handlekickmsg(void *source, int cargc, char **cargv) { /* Find out who we are talking about here */ if ((np=getnickbynumericstr(cargv[1]))==NULL) { - Error("channel",ERR_DEBUG,"Non-existant numeric %s kicked from channel %s",source,cargv[0]); + Error("channel",ERR_DEBUG,"Non-existant numeric %s kicked from channel %s",(char *)source,cargv[0]); return CMD_OK; } @@ -508,10 +508,15 @@ int handletopicmsg(void *source, int cargc, char **cargv) { if (cargc>3) timestamp=strtol(cargv[cargc-3], NULL, 10); - if ((np=getnickbynumericstr((char *)source))==NULL) { + np=getnickbynumericstr((char *)source); + + /* The following check removed because servers can set topics.. */ +#if 0 + if (np==NULL) { /* We should check the sender exists, but we still change the topic even if it doesn't */ Error("channel",ERR_WARNING,"Topic change by non-existent user %s",(char *)source); } +#endif /* Grab channel pointer */ if ((cp=findchannel(cargv[0]))==NULL) { @@ -558,11 +563,11 @@ int handlemodemsg(void *source, int cargc, char **cargv) { int arg=2; char *modestr; unsigned long *lp; - void *harg[3]; + void *harg[4]; nick *np, *target; int hooknum; int changes=0; - + if (cargc<2) { return CMD_OK; } @@ -589,6 +594,7 @@ int handlemodemsg(void *source, int cargc, char **cargv) { /* Set up the hook data */ harg[0]=cp; harg[1]=np; + harg[3]=(void *)(long)(cp->flags); /* Process the mode string one character at a time */ /* Maybe I'll write this more intelligently one day if I can comprehend the ircu code that does this */ @@ -770,7 +776,7 @@ int handlemodemsg(void *source, int cargc, char **cargv) { int handleclearmodemsg(void *source, int cargc, char **cargv) { channel *cp; - void *harg[3]; + void *harg[4]; nick *np, *target; char *mcp; unsigned long usermask=0; @@ -797,7 +803,8 @@ int handleclearmodemsg(void *source, int cargc, char **cargv) { harg[0]=cp; harg[1]=np; - + harg[3]=(void *)(long)(cp->flags); + for (mcp=cargv[1];*mcp;mcp++) { switch (*mcp) { case 'o': @@ -935,10 +942,16 @@ void handlewhoischannels(int hooknum, void *arg) { sstring *name; unsigned long *num; int i; - void **args = (void **)arg; - nick *sender = (nick *)args[0], *target = (nick *)args[1]; - - if(IsService(target) || IsHideChan(target)) + char **args = (char **)arg; + nick *sender = (nick *)args[0]; /* sender nick */ + nick *target = (nick *)args[1]; /* target nick */ + char *sourcenum = args[2]; /* source numeric */ + + /* do not show channels for +k service clients or IRC Operators + * do not show channels for +n users + * unless they whois themselves + */ + if ((IsService(target) || IsHideChan(target)) && sender != target) return; chans = (channel **)(target->channels->content); @@ -961,8 +974,13 @@ void handlewhoischannels(int hooknum, void *arg) { bufpos=0; } + /* + * 319 RPL_WHOISCHANNELS "source 319 target nick :channels" + * "irc.netsplit.net 319 foobar barfoo :@#chan1 +#chan2 #chan3" + * "irc.netsplit.net 319 foobar barfoo :-@#chan1 -+#chan2 -#chan3" + */ if(buffer[0] == '\0') - bufpos=snprintf(buffer, sizeof(buffer), ":%s 319 %s %s :", myserver->content, sender->nick, target->nick); + bufpos=snprintf(buffer, sizeof(buffer), "%s 319 %s %s :", getmynumeric(), sourcenum, target->nick); num = getnumerichandlefromchanhash(chans[i]->users, target->numeric);