#include "s_serv.h"
#include "s_conf.h"
#include "hook.h"
+#include "messages.h"
unsigned int CAP_REMOVE;
+static char part_buf[REASONLEN + 1];
static int m_remove(struct Client *, struct Client *, int, const char **);
+static void remove_quote_part(hook_data_privmsg_channel *);
struct Message remove_msgtab = {
"REMOVE", 0, 0, 0, MFLG_SLOW,
};
mapi_clist_av1 remove_clist[] = { &remove_msgtab, NULL };
+mapi_hfn_list_av1 remove_hfnlist[] = {
+ { "privmsg_channel", (hookfn) remove_quote_part },
+ { NULL, NULL }
+};
static int
modinit(void)
{
CAP_REMOVE = capability_put(serv_capindex, "REMOVE");
- capability_require(serv_capindex, "REMOVE");
return 0;
}
capability_orphan(serv_capindex, "REMOVE");
}
-DECLARE_MODULE_AV1(remove, modinit, moddeinit, remove_clist, NULL, NULL, "$Revision: 3317 $");
+DECLARE_MODULE_AV1(remove, modinit, moddeinit, remove_clist, NULL, remove_hfnlist, "$Revision: 3317 $");
static int
m_remove(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
return 0;
}
- if(get_channel_access(source_p, msptr) < CHFL_CHANOP)
+ if(get_channel_access(source_p, chptr, msptr, MODE_ADD, NULL) < CHFL_CHANOP)
{
if(MyConnect(source_p))
{
* There are two cases we can get to this point then...
*
* 1) connect burst is happening, and for some reason a legit
- * op has sent a KICK, but the SJOIN hasn't happened yet or
+ * op has sent a KICK, but the SJOIN hasn't happened yet or
* been seen. (who knows.. due to lag...)
*
* 2) The channel is desynced. That can STILL happen with TS
- *
- * Now, the old code roger wrote, would allow the KICK to
+ *
+ * Now, the old code roger wrote, would allow the KICK to
* go through. Thats quite legit, but lets weird things like
* KICKS by users who appear not to be chanopped happen,
* or even neater, they appear not to be on the channel.
hookdata.msptr = msptr;
hookdata.target = who;
hookdata.approved = 1;
+ hookdata.dir = MODE_ADD; /* ensure modules like override speak up */
call_hook(h_can_kick, &hookdata);
*/
sendto_channel_local(ALL_MEMBERS, chptr,
":%s!%s@%s PART %s :requested by %s (%s)",
- source_p->name, source_p->username,
- source_p->host, name, who->name, comment);
+ who->name, who->username,
+ who->host, name, source_p->name, comment);
sendto_server(client_p, chptr, CAP_REMOVE, NOCAPS,
":%s REMOVE %s %s :%s",
return 0;
}
+static void
+remove_quote_part(hook_data_privmsg_channel *data)
+{
+ if (data->approved || EmptyString(data->text) || data->msgtype != MESSAGE_TYPE_PART)
+ return;
+
+ rb_strlcpy(part_buf, "\"", sizeof(part_buf) - 1);
+ rb_strlcat(part_buf, data->text, sizeof(part_buf) - 1);
+ rb_strlcat(part_buf, "\"", sizeof(part_buf));
+
+ data->text = part_buf;
+}