]> jfr.im git - irc/rqf/shadowircd.git/blobdiff - modules/m_topic.c
Make +-a give you the appropriate error message if you don't have
[irc/rqf/shadowircd.git] / modules / m_topic.c
index a69a99e29d5b47271a1b7e5650cf24600ee94b99..cddf5f94f8cb9061e0c3f3b166ab4c2773e1bd98 100644 (file)
@@ -53,7 +53,6 @@ DECLARE_MODULE_AV1(topic, NULL, NULL, topic_clist, NULL, NULL, "$Revision: 254 $
 
 /*
  * m_topic
- *      parv[0] = sender prefix
  *      parv[1] = channel name
  *     parv[2] = new topic, if setting topic
  */
@@ -106,6 +105,8 @@ m_topic(struct Client *client_p, struct Client *source_p, int parc, const char *
        /* setting topic */
        if(parc > 2)
        {
+               char topic_info[USERHOST_REPLYLEN];
+
                msptr = find_channel_membership(chptr, source_p);
 
                if(msptr == NULL)
@@ -115,11 +116,27 @@ m_topic(struct Client *client_p, struct Client *source_p, int parc, const char *
                        return 0;
                }
 
-               if((chptr->mode.mode & MODE_TOPICLIMIT) == 0 || is_chanop(msptr))
+               if(MyClient(source_p) && (chptr->mode.mode & MODE_TOPICLIMIT) && !is_chanop(msptr))
                {
-                       char topic_info[USERHOST_REPLYLEN];
-                       rb_sprintf(topic_info, "%s!%s@%s",
-                                       source_p->name, source_p->username, source_p->host);
+                       if(IsOverride(source_p))
+                               sendto_realops_snomask(SNO_GENERAL, L_NETWIDE,
+                                               "%s is overriding TOPIC on [%s]",
+                                               get_oper_name(source_p), chptr->chname);
+                       else
+                       {
+                               sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED),
+                                               me.name, source_p->name, parv[1]);
+                               return 0;
+                       }
+
+               }
+
+                       if(ConfigChannel.host_in_topic)
+                               rb_sprintf(topic_info, "%s!%s@%s",
+                                               source_p->name, source_p->username, source_p->host);
+                       else
+                               rb_strlcpy(topic_info, source_p->name, sizeof(topic_info));
+
                        set_channel_topic(chptr, parv[2], topic_info, rb_current_time());
 
                        sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
@@ -131,10 +148,7 @@ m_topic(struct Client *client_p, struct Client *source_p, int parc, const char *
                                        source_p->name, source_p->username,
                                        source_p->host, chptr->chname,
                                        chptr->topic == NULL ? "" : chptr->topic);
-               }
-               else
-                       sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED),
-                                       me.name, source_p->name, name);
+
        }
        else if(MyClient(source_p))
        {
@@ -166,7 +180,6 @@ m_topic(struct Client *client_p, struct Client *source_p, int parc, const char *
 
 /*
  * ms_topic
- *      parv[0] = sender prefix
  *      parv[1] = channel name
  *     parv[2] = topic_info
  *     parv[3] = topic_info time