Author: Ghostwolf <foxxe@wtfs.net>
[ircu2.10.12-pk.git] / ircd / m_topic.c
index 2b7756e64ab67342d8f8ec134930fd31e9a6bada..b8cfc82822d0616b4af43318a33c5de8b28a0842 100644 (file)
  *            note:   it is guaranteed that parv[0]..parv[parc-1] are all
  *                    non-NULL pointers.
  */
-#if 0
-/*
- * No need to include handlers.h here the signatures must match
- * and we don't need to force a rebuild of all the handlers everytime
- * we add a new one to the list. --Bleep
- */
-#include "handlers.h"
-#endif /* 0 */
+#include "config.h"
+
 #include "channel.h"
 #include "client.h"
 #include "hash.h"
@@ -117,15 +111,15 @@ static void do_settopic(struct Client *sptr, struct Client *cptr,
    newtopic=ircd_strncmp(chptr->topic,topic,TOPICLEN)!=0;
    /* setting a topic */
    ircd_strncpy(chptr->topic, topic, TOPICLEN);
-   ircd_strncpy(chptr->topic_nick, sptr->name, NICKLEN);
+   ircd_strncpy(chptr->topic_nick, cli_name(sptr), NICKLEN);
    chptr->topic_time = CurrentTime;
    /* Fixed in 2.10.11: Don't propergate local topics */
    if (!IsLocalChannel(chptr->chname))
      sendcmdto_serv_butone(sptr, CMD_TOPIC, cptr, "%H :%s", chptr,
                           chptr->topic);
    if (newtopic)
-      sendcmdto_channel_butserv(sptr, CMD_TOPIC, chptr, "%H :%s", chptr,
-                                 chptr->topic);
+      sendcmdto_channel_butserv_butone(sptr, CMD_TOPIC, chptr, NULL,
+                                      "%H :%s", chptr, chptr->topic);
       /* if this is the same topic as before we send it to the person that
        * set it (so they knew it went through ok), but don't bother sending
        * it to everyone else on the channel to save bandwidth
@@ -220,14 +214,17 @@ int ms_topic(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
     /* Modeless Channels don't have topics */
     if (IsModelessChannel(name))
     {
-      /* Protocol Violation? */
+      protocol_violation(sptr,"Attempted to topic modeless channel");
       send_reply(sptr, ERR_CHANOPRIVSNEEDED, chptr->chname);
       continue;
     }
+
     /* Ignore requests for topics from remote servers */
     if (IsLocalChannel(name) && !MyUser(sptr))
-      /* Protocol Violation warning here? */
+    {
+      protocol_violation(sptr,"Topic request");
       continue;
+    }
 
     do_settopic(sptr,cptr,chptr,topic);
   }