X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fcmd_topic.cpp;h=c1eb50532defec87b7e14c655fc86e413d972d5b;hb=59b1a8955142935b02af6446005ab47fc7c3fc8c;hp=d3377c33faefe2559670b30be32fc07c39e8e61c;hpb=9826d2ee0a26234a4f5421ae686b0068f3f64c57;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/cmd_topic.cpp b/src/cmd_topic.cpp index d3377c33f..c1eb50532 100644 --- a/src/cmd_topic.cpp +++ b/src/cmd_topic.cpp @@ -2,10 +2,10 @@ * | Inspire Internet Relay Chat Daemon | * +------------------------------------+ * - * Inspire is copyright (C) 2002-2005 ChatSpike-Dev. + * InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev. * E-mail: - * - * + * + * * * Written by Craig Edwards, Craig McLure, and others. * This program is free but copyrighted software; see @@ -102,15 +102,18 @@ void cmd_topic::Handle (char **parameters, int pcnt, userrec *user) Ptr = FindChan(parameters[0]); if (Ptr) { - if ((Ptr) && (!has_channel(user,Ptr))) + if (IS_LOCAL(user)) { - WriteServ(user->fd,"442 %s %s :You're not on that channel!",user->nick, Ptr->name); - return; - } - if ((Ptr->binarymodes & CM_TOPICLOCK) && (cstatus(user,Ptr)fd,"482 %s %s :You must be at least a half-operator to change modes on this channel", user->nick, Ptr->name); - return; + if ((Ptr) && (!has_channel(user,Ptr))) + { + WriteServ(user->fd,"442 %s %s :You're not on that channel!",user->nick, Ptr->name); + return; + } + if ((Ptr->binarymodes & CM_TOPICLOCK) && (cstatus(user,Ptr)fd,"482 %s %s :You must be at least a half-operator to change modes on this channel", user->nick, Ptr->name); + return; + } } char topic[MAXBUF]; @@ -120,7 +123,7 @@ void cmd_topic::Handle (char **parameters, int pcnt, userrec *user) topic[MAXTOPIC] = '\0'; } - if (user->fd > -1) + if (IS_LOCAL(user)) { int MOD_RESULT = 0; FOREACH_RESULT(I_OnLocalTopicChange,OnLocalTopicChange(user,Ptr,topic)); @@ -129,10 +132,10 @@ void cmd_topic::Handle (char **parameters, int pcnt, userrec *user) } strlcpy(Ptr->topic,topic,MAXTOPIC); - strlcpy(Ptr->setby,user->nick,NICKMAX); + strlcpy(Ptr->setby,user->nick,NICKMAX-1); Ptr->topicset = TIME; WriteChannel(Ptr,user,"TOPIC %s :%s",Ptr->name, Ptr->topic); - if (user->fd > -1) + if (IS_LOCAL(user)) { FOREACH_MOD(I_OnPostLocalTopicChange,OnPostLocalTopicChange(user,Ptr,topic)); }