]> jfr.im git - solanum.git/blobdiff - modules/core/m_part.c
ircd: send tags on every message
[solanum.git] / modules / core / m_part.c
index 95e3e66f7058725e36e6b1bb26e556574e227a7c..6a778b28ae685bd93c69c18ed50bd096286b89b1 100644 (file)
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
  *  USA
- *
- *  $Id: m_part.c 98 2005-09-11 03:37:47Z nenolod $
  */
 
 #include "stdinc.h"
 #include "channel.h"
 #include "client.h"
-#include "common.h"
 #include "hash.h"
 #include "match.h"
 #include "ircd.h"
@@ -42,7 +39,9 @@
 #include "inline/stringops.h"
 #include "hook.h"
 
-static int m_part(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
+static const char part_desc[] = "Provides the PART command to leave a channel";
+
+static void m_part(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
 
 struct Message part_msgtab = {
        "PART", 0, 0, 0, 0,
@@ -51,13 +50,13 @@ struct Message part_msgtab = {
 
 mapi_clist_av1 part_clist[] = { &part_msgtab, NULL };
 
-DECLARE_MODULE_AV1(part, NULL, NULL, part_clist, NULL, NULL, "$Revision: 98 $");
+DECLARE_MODULE_AV2(part, NULL, NULL, part_clist, NULL, NULL, NULL, NULL, part_desc);
 
 static void part_one_client(struct Client *client_p,
                            struct Client *source_p, char *name,
                            const char *reason);
-static int can_send_part(struct Client *source_p, struct Channel *chptr, struct membership *msptr);
-static int do_message_hook(struct Client *source_p, struct Channel *chptr, const char **reason);
+static bool can_send_part(struct Client *source_p, struct Channel *chptr, struct membership *msptr);
+static bool do_message_hook(struct Client *source_p, struct Channel *chptr, const char **reason);
 
 
 /*
@@ -65,7 +64,7 @@ static int do_message_hook(struct Client *source_p, struct Channel *chptr, const
 **      parv[1] = channel
 **      parv[2] = reason
 */
-static int
+static void
 m_part(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
 {
        char *p, *name;
@@ -88,7 +87,6 @@ m_part(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
                part_one_client(client_p, source_p, name, reason);
                name = rb_strtok_r(NULL, ",", &p);
        }
-       return 0;
 }
 
 /*
@@ -135,7 +133,7 @@ part_one_client(struct Client *client_p, struct Client *source_p, char *name, co
 
                sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
                              ":%s PART %s :%s", use_id(source_p), chptr->chname, reason);
-               sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s PART %s :%s",
+               sendto_channel_local(source_p, ALL_MEMBERS, chptr, ":%s!%s@%s PART %s :%s",
                                     source_p->name, source_p->username,
                                     source_p->host, chptr->chname, reason);
        }
@@ -143,7 +141,7 @@ part_one_client(struct Client *client_p, struct Client *source_p, char *name, co
        {
                sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
                              ":%s PART %s", use_id(source_p), chptr->chname);
-               sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s PART %s",
+               sendto_channel_local(source_p, ALL_MEMBERS, chptr, ":%s!%s@%s PART %s",
                                     source_p->name, source_p->username,
                                     source_p->host, chptr->chname);
        }
@@ -158,19 +156,19 @@ part_one_client(struct Client *client_p, struct Client *source_p, char *name, co
  *    - channel being parted
  *    - membership pointer
  * outputs:
- *    - 1 if message allowed
- *    - 0 if message denied
+ *    - true if message allowed
+ *    - false if message denied
  * side effects:
  *    - none.
  */
-static int
+static bool
 can_send_part(struct Client *source_p, struct Channel *chptr, struct membership *msptr)
 {
        if (!can_send(chptr, source_p, msptr))
-               return 0;
+               return false;
        /* Allow chanops to bypass anti_spam_exit_message_time for part messages. */
        if (is_chanop(msptr))
-               return 1;
+               return true;
        return (source_p->localClient->firsttime + ConfigFileEntry.anti_spam_exit_message_time) < rb_current_time();
 }
 
@@ -182,12 +180,12 @@ can_send_part(struct Client *source_p, struct Channel *chptr, struct membership
  *    - channel being parted
  *    - pointer to reason
  * outputs:
- *    - 1 if message is allowed
- *    - 0 if message is denied or message is now empty
+ *    - true if message is allowed
+ *    - false if message is denied or message is now empty
  * side effects:
  *    - reason may be modified.
  */
-static int
+static bool
 do_message_hook(struct Client *source_p, struct Channel *chptr, const char **reason)
 {
        hook_data_privmsg_channel hdata;