]> jfr.im git - solanum.git/blobdiff - modules/m_tb.c
Mint CLICAP_FLAGS_PRIORITY
[solanum.git] / modules / m_tb.c
index e02cc5725b64e997f9cac6590f36fbfe4caed68d..d925b457df58d3156ba215351820be5ff2555293 100644 (file)
@@ -1,5 +1,5 @@
 /* modules/m_tb.c
- * 
+ *
  *  Copyright (C) 2003 Lee Hardy <lee@leeh.co.uk>
  *  Copyright (C) 2003-2005 ircd-ratbox development team
  *
  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE.
- *
- * $Id: m_tb.c 1349 2006-05-17 17:37:46Z jilles $
  */
 
 #include "stdinc.h"
 #include "send.h"
 #include "channel.h"
 #include "client.h"
-#include "common.h"
-#include "config.h"
+#include "defaults.h"
 #include "ircd.h"
 #include "match.h"
 #include "s_conf.h"
 #include "hash.h"
 #include "s_serv.h"
 
-static int ms_tb(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
-static int ms_etb(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
+static const char tb_desc[] =
+       "Provides TS6 TB and ETB commands for topic bursting between servers";
+
+static void ms_tb(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
+static void ms_etb(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
 
 struct Message tb_msgtab = {
-       "TB", 0, 0, 0, MFLG_SLOW,
+       "TB", 0, 0, 0, 0,
        {mg_unreg, mg_ignore, mg_ignore, {ms_tb, 4}, mg_ignore, mg_ignore}
 };
 
 struct Message etb_msgtab = {
-       "ETB", 0, 0, 0, MFLG_SLOW,
+       "ETB", 0, 0, 0, 0,
        {mg_unreg, mg_ignore, {ms_etb, 5}, {ms_etb, 5}, mg_ignore, mg_ignore}
 };
 
 mapi_clist_av1 tb_clist[] =  { &tb_msgtab, &etb_msgtab, NULL };
-DECLARE_MODULE_AV1(tb, NULL, NULL, tb_clist, NULL, NULL, "$Revision: 1349 $");
+DECLARE_MODULE_AV2(tb, NULL, NULL, tb_clist, NULL, NULL, NULL, NULL, tb_desc);
 
 /* m_tb()
  *
@@ -67,8 +67,8 @@ DECLARE_MODULE_AV1(tb, NULL, NULL, tb_clist, NULL, NULL, "$Revision: 1349 $");
  * parv[3] - optional topicwho/topic
  * parv[4] - topic
  */
-static int
-ms_tb(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
+static void
+ms_tb(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
 {
        struct Channel *chptr;
        const char *newtopic;
@@ -79,7 +79,7 @@ ms_tb(struct Client *client_p, struct Client *source_p, int parc, const char *pa
        chptr = find_channel(parv[1]);
 
        if(chptr == NULL)
-               return 0;
+               return;
 
        newtopicts = atol(parv[2]);
 
@@ -101,7 +101,7 @@ ms_tb(struct Client *client_p, struct Client *source_p, int parc, const char *pa
        }
 
        if (EmptyString(newtopic))
-               return 0;
+               return;
 
        if(chptr->topic == NULL || chptr->topic_time > newtopicts)
        {
@@ -110,10 +110,10 @@ ms_tb(struct Client *client_p, struct Client *source_p, int parc, const char *pa
                 * same topic just drop the message --fl
                 */
                if(chptr->topic != NULL && strcmp(chptr->topic, newtopic) == 0)
-                       return 0;
+                       return;
 
                set_channel_topic(chptr, newtopic, newtopicwho, newtopicts);
-               sendto_channel_local(ALL_MEMBERS, chptr, ":%s TOPIC %s :%s",
+               sendto_channel_local(fakesource_p, ALL_MEMBERS, chptr, ":%s TOPIC %s :%s",
                                     fakesource_p->name, chptr->chname, newtopic);
                sendto_server(client_p, chptr, CAP_TB|CAP_TS6, NOCAPS,
                              ":%s TB %s %ld %s%s:%s",
@@ -121,8 +121,6 @@ ms_tb(struct Client *client_p, struct Client *source_p, int parc, const char *pa
                              ConfigChannel.burst_topicwho ? chptr->topic_info : "",
                              ConfigChannel.burst_topicwho ? " " : "", chptr->topic);
        }
-
-       return 0;
 }
 
 /* ms_etb()
@@ -133,8 +131,8 @@ ms_tb(struct Client *client_p, struct Client *source_p, int parc, const char *pa
  * parv[4] - topicwho
  * parv[5] - topic
  */
-static int
-ms_etb(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
+static void
+ms_etb(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
 {
        struct Channel *chptr;
        const char *newtopic;
@@ -147,7 +145,7 @@ ms_etb(struct Client *client_p, struct Client *source_p, int parc, const char *p
        chptr = find_channel(parv[2]);
 
        if(chptr == NULL)
-               return 0;
+               return;
 
        newtopicts = atol(parv[3]);
 
@@ -179,7 +177,7 @@ ms_etb(struct Client *client_p, struct Client *source_p, int parc, const char *p
                if(textchange)
                {
                        if (IsPerson(fakesource_p))
-                               sendto_channel_local(ALL_MEMBERS, chptr,
+                               sendto_channel_local(fakesource_p, ALL_MEMBERS, chptr,
                                                ":%s!%s@%s TOPIC %s :%s",
                                                fakesource_p->name,
                                                fakesource_p->username,
@@ -187,7 +185,7 @@ ms_etb(struct Client *client_p, struct Client *source_p, int parc, const char *p
                                                chptr->chname,
                                                newtopic);
                        else
-                               sendto_channel_local(ALL_MEMBERS, chptr,
+                               sendto_channel_local(fakesource_p, ALL_MEMBERS, chptr,
                                                ":%s TOPIC %s :%s",
                                                fakesource_p->name,
                                                chptr->chname, newtopic);
@@ -249,6 +247,4 @@ ms_etb(struct Client *client_p, struct Client *source_p, int parc, const char *p
                                      me.id, chptr->chname, chptr->chname);
                }
        }
-
-       return 0;
 }