* | Inspire Internet Relay Chat Daemon |
* +------------------------------------+
*
- * Inspire is copyright (C) 2002-2005 ChatSpike-Dev.
+ * InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
* E-mail:
- * <brain.net>
- * <Craig.net>
+ * <brain@chatspike.net>
+ * <Craig@chatspike.net>
*
* Written by Craig Edwards, Craig McLure, and others.
* This program is free but copyrighted software; see
extern whowas_hash whowas;
extern std::vector<userrec*> all_opers;
extern std::vector<userrec*> local_users;
-extern userrec* fd_ref_table[65536];
+extern userrec* fd_ref_table[MAX_DESCRIPTORS];
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)<STATUS_HOP))
- {
- WriteServ(user->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)<STATUS_HOP))
+ {
+ WriteServ(user->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];
topic[MAXTOPIC] = '\0';
}
- if (user->fd > -1)
+ if (IS_LOCAL(user))
{
int MOD_RESULT = 0;
- FOREACH_RESULT(OnLocalTopicChange(user,Ptr,topic));
+ FOREACH_RESULT(I_OnLocalTopicChange,OnLocalTopicChange(user,Ptr,topic));
if (MOD_RESULT)
return;
}
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 OnPostLocalTopicChange(user,Ptr,topic);
+ FOREACH_MOD(I_OnPostLocalTopicChange,OnPostLocalTopicChange(user,Ptr,topic));
}
}
else