]> jfr.im git - irc/rqf/shadowircd.git/blobdiff - modules/m_topic.c
Change the defaul nicklen back to 31. This is more efficient due to struct packing.
[irc/rqf/shadowircd.git] / modules / m_topic.c
index 001a5e1cdc7c50b3521c66393ac05a2f91e45ee6..2fd20723a31d7c939428bc5940912e8bce433105 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"
@@ -39,6 +38,7 @@
 #include "parse.h"
 #include "modules.h"
 #include "packet.h"
+#include "tgchange.h"
 
 static int m_topic(struct Client *, struct Client *, int, const char **);
 static int ms_topic(struct Client *, struct Client *, int, const char **);
@@ -105,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)
@@ -114,9 +116,34 @@ 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) || IsOverride(source_p))
+               if(MyClient(source_p) && !is_chanop_voiced(msptr) &&
+                               !IsOper(source_p) &&
+                               !add_channel_target(source_p, chptr))
+               {
+                       sendto_one(source_p, form_str(ERR_TARGCHANGE),
+                                  me.name, source_p->name, chptr->chname);
+                       return 0;
+               }
+
+               if(MyClient(source_p) && (chptr->mode.mode & MODE_TOPICLIMIT) && !is_any_op(msptr))
                {
-                       char topic_info[USERHOST_REPLYLEN];
+                       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",
@@ -135,11 +162,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),
-                                       get_id(&me, source_p),
-                                       get_id(source_p, source_p), name);
+
        }
        else if(MyClient(source_p))
        {