]> jfr.im git - irc/rqf/shadowircd.git/blobdiff - modules/m_topic.c
Removal of ancient SVN ID's part one
[irc/rqf/shadowircd.git] / modules / m_topic.c
index d8ad5b9d6f19f4b0426115e2a705b04648674a8e..439e456dc5f1f10cf25b6d6a19b367498ac5bc60 100644 (file)
@@ -21,7 +21,6 @@
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
  *  USA
  *
- *  $Id: m_topic.c 254 2005-09-21 23:35:12Z nenolod $
  */
 
 #include "stdinc.h"
@@ -105,6 +104,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)
@@ -114,11 +115,32 @@ 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_any_op(msptr) && !can_send(chptr, source_p, 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_wallops_flags(UMODE_WALLOP, &me,
+                                               "%s is overriding TOPIC on [%s]",
+                                               get_oper_name(source_p), chptr->chname);
+                               sendto_server(NULL, chptr, NOCAPS, NOCAPS,
+                                               ":%s WALLOPS :%s is overriding TOPIC on [%s]",
+                                               me.name, 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,
@@ -130,10 +152,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))
        {