| 1 |
/* |
| 2 |
* Copyright (c) 2008 William Pitcock |
| 3 |
* Rights to this code are as documented in doc/LICENSE. |
| 4 |
* |
| 5 |
* Because sometimes premadonna assholes with large ignore lists |
| 6 |
* piss entire channels the hell off... |
| 7 |
* |
| 8 |
* So what does this do? |
| 9 |
* ===================== |
| 10 |
* |
| 11 |
* It repeats everything someone says and to be extra annoying, highlights |
| 12 |
* the person who has public ignore notification spam. |
| 13 |
* |
| 14 |
* It was written for the purpose of mockery of someone on #atheme-project |
| 15 |
* who makes claims like "I have the whole channel on ignore", etc. |
| 16 |
* |
| 17 |
* Pro tip: we don't care about your ignore list. |
| 18 |
* |
| 19 |
* How do I use it? I have an asshole on my channel too! |
| 20 |
* ===================================================== |
| 21 |
* |
| 22 |
* Load the module, set these options: |
| 23 |
* |
| 24 |
* - babbler:enable to actually enable babbler |
| 25 |
* - babbler:nicks, the actual ignore list of the asshole |
| 26 |
* - babbler:target, the nick of the person who needs to be pwnt |
| 27 |
* - babbler:source, the nick of a psuedoclient to send the message |
| 28 |
* from. |
| 29 |
* |
| 30 |
* Will you make it PM them instead? |
| 31 |
* ================================= |
| 32 |
* |
| 33 |
* Absolutely not. Then it could be used for spambots, etc. That's a really |
| 34 |
* bad idea. |
| 35 |
*/ |
| 36 |
|
| 37 |
#include "atheme-compat.h" |
| 38 |
|
| 39 |
static void |
| 40 |
on_channel_message(hook_cmessage_data_t *data) |
| 41 |
{ |
| 42 |
if (data != NULL && data->msg != NULL) |
| 43 |
{ |
| 44 |
mychan_t *mc = mychan_from(data->c); |
| 45 |
metadata_t *md; |
| 46 |
|
| 47 |
if (!mc) |
| 48 |
return; |
| 49 |
|
| 50 |
if (!metadata_find(mc, "babbler:enable")) |
| 51 |
return; |
| 52 |
|
| 53 |
if (!(md = metadata_find(mc, "babbler:nicks"))) |
| 54 |
return; |
| 55 |
|
| 56 |
if (strstr(md->value, data->u->nick)) |
| 57 |
{ |
| 58 |
char *source = NULL; |
| 59 |
char *target; |
| 60 |
|
| 61 |
if (!(md = metadata_find(mc, "babbler:target"))) |
| 62 |
return; |
| 63 |
|
| 64 |
target = md->value; |
| 65 |
|
| 66 |
if (!(md = metadata_find(mc, "babbler:source"))) |
| 67 |
source = chansvs.nick; |
| 68 |
else |
| 69 |
source = md->value; |
| 70 |
|
| 71 |
msg(source, data->c->name, "%s: <%s> %s", target, data->u->nick, data->msg); |
| 72 |
} |
| 73 |
} |
| 74 |
} |
| 75 |
|
| 76 |
static void |
| 77 |
mod_init(module_t *const restrict m) |
| 78 |
{ |
| 79 |
hook_add_event("channel_message"); |
| 80 |
hook_add_channel_message(on_channel_message); |
| 81 |
} |
| 82 |
|
| 83 |
static void |
| 84 |
mod_deinit(const module_unload_intent_t intent) |
| 85 |
{ |
| 86 |
hook_del_channel_message(on_channel_message); |
| 87 |
} |
| 88 |
|
| 89 |
VENDOR_DECLARE_MODULE_V1("contrib/cs_babbler", MODULE_UNLOAD_CAPABILITY_OK, CONTRIB_VENDOR_NENOLOD) |