2 * charybdis: an advanced ircd.
3 * chm_nocolour: strip colours (+c mode).
5 * Copyright (c) 2012 William Pitcock <nenolod@dereferenced.org>
7 * Permission to use, copy, modify, and/or distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice is present in all copies.
11 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
12 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
13 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
14 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
15 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
16 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
17 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
18 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
19 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
20 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
21 * POSSIBILITY OF SUCH DAMAGE.
35 #include "inline/stringops.h"
37 static char buf
[BUFSIZE
];
38 static unsigned int mode_nocolour
;
40 static void chm_nocolour_process(hook_data_privmsg_channel
*);
42 mapi_hfn_list_av1 chm_nocolour_hfnlist
[] = {
43 { "privmsg_channel", (hookfn
) chm_nocolour_process
},
48 chm_nocolour_process(hook_data_privmsg_channel
*data
)
50 /* don't waste CPU if message is already blocked */
54 if (data
->chptr
->mode
.mode
& mode_nocolour
)
56 rb_strlcpy(buf
, data
->text
, sizeof buf
);
66 mode_nocolour
= cflag_add('c', chm_simple
);
67 if (mode_nocolour
== 0)
79 DECLARE_MODULE_AV1(chm_nocolour
, _modinit
, _moddeinit
, NULL
, NULL
, chm_nocolour_hfnlist
, "$Revision$");