diff options
author | LemonBoy <thatlemon@gmail.com> | 2015-09-09 23:55:00 +0200 |
---|---|---|
committer | LemonBoy <thatlemon@gmail.com> | 2015-09-09 23:55:00 +0200 |
commit | 4346c2a6d479b9c4d94fabc35ade324fdbe0e0d0 (patch) | |
tree | 9ec96a4028af9a033136cd50124bad6c71e798b5 | |
parent | 57d645f24603e8c7d2cfe7098b3dbb1359cd8d22 (diff) | |
download | irssi-4346c2a6d479b9c4d94fabc35ade324fdbe0e0d0.zip |
Move the function prototypes in a separate header
-rw-r--r-- | src/fe-common/irc/fe-common-irc.c | 4 | ||||
-rw-r--r-- | src/fe-common/irc/fe-events.c | 3 | ||||
-rw-r--r-- | src/fe-common/irc/fe-irc-channels.c | 47 | ||||
-rw-r--r-- | src/fe-common/irc/fe-irc-channels.h | 10 | ||||
-rw-r--r-- | src/fe-common/irc/fe-irc-messages.c | 45 |
5 files changed, 57 insertions, 52 deletions
diff --git a/src/fe-common/irc/fe-common-irc.c b/src/fe-common/irc/fe-common-irc.c index 72606263..d6ab30ce 100644 --- a/src/fe-common/irc/fe-common-irc.c +++ b/src/fe-common/irc/fe-common-irc.c @@ -28,13 +28,11 @@ #include "themes.h" #include "fe-irc-server.h" +#include "fe-irc-channels.h" void fe_irc_modules_init(void); void fe_irc_modules_deinit(void); -void fe_irc_channels_init(void); -void fe_irc_channels_deinit(void); - void fe_irc_queries_init(void); void fe_irc_queries_deinit(void); diff --git a/src/fe-common/irc/fe-events.c b/src/fe-common/irc/fe-events.c index 7f5a8c26..068ee543 100644 --- a/src/fe-common/irc/fe-events.c +++ b/src/fe-common/irc/fe-events.c @@ -42,9 +42,6 @@ #include "fe-windows.h" #include "fe-irc-server.h" -int fe_channel_is_opchannel(IRC_SERVER_REC *server, const char *target); -const char *fe_channel_skip_prefix(IRC_SERVER_REC *server, const char *target); - static void event_privmsg(IRC_SERVER_REC *server, const char *data, const char *nick, const char *addr) { diff --git a/src/fe-common/irc/fe-irc-channels.c b/src/fe-common/irc/fe-irc-channels.c index 9129e451..d5f17bd0 100644 --- a/src/fe-common/irc/fe-irc-channels.c +++ b/src/fe-common/irc/fe-irc-channels.c @@ -31,6 +31,51 @@ #include "fe-windows.h" #include "window-items.h" +int fe_channel_is_opchannel(IRC_SERVER_REC *server, const char *target) +{ + const char *statusmsg; + + /* Quick check */ + if (server == NULL || server->prefix[(int)(unsigned char)*target] == 0) + return FALSE; + + statusmsg = g_hash_table_lookup(server->isupport, "statusmsg"); + if (statusmsg == NULL) + statusmsg = "@+"; + + return strchr(statusmsg, *target) != NULL; +} + +const char *fe_channel_skip_prefix(IRC_SERVER_REC *server, const char *target) +{ + const char *statusmsg; + + /* Quick check */ + if (server == NULL || server->prefix[(int)(unsigned char)*target] == 0) + return target; + + /* Exit early if target doesn't name a channel */ + if (server_ischannel(SERVER(server), target) == FALSE) + return FALSE; + + statusmsg = g_hash_table_lookup(server->isupport, "statusmsg"); + + /* Hack: for bahamut 1.4 which sends neither STATUSMSG nor + * WALLCHOPS in 005, accept @#chan and @+#chan (but not +#chan) */ + if (statusmsg == NULL && *target != '@') + return target; + + if (statusmsg == NULL) + statusmsg = "@+"; + + /* Strip the leading statusmsg prefixes */ + while (strchr(statusmsg, *target) != NULL) { + target++; + } + + return target; +} + static void sig_channel_rejoin(SERVER_REC *server, REJOIN_REC *rec) { g_return_if_fail(rec != NULL); @@ -46,7 +91,7 @@ static void sig_event_forward(SERVER_REC *server, const char *data, char *params, *from, *to; params = event_get_params(data, 3, NULL, &from, &to); - if (from != NULL && to != NULL && server_ischannel(server, *from) && server_ischannel(server, *to)) { + if (from != NULL && to != NULL && server_ischannel(server, from) && server_ischannel(server, to)) { channel = irc_channel_find(server, from); if (channel != NULL && irc_channel_find(server, to) == NULL) { window_bind_add(window_item_window(channel), diff --git a/src/fe-common/irc/fe-irc-channels.h b/src/fe-common/irc/fe-irc-channels.h new file mode 100644 index 00000000..d05c91a5 --- /dev/null +++ b/src/fe-common/irc/fe-irc-channels.h @@ -0,0 +1,10 @@ +#ifndef __FE_IRC_CHANNELS_H +#define __FE_IRC_CHANNELS_H + +int fe_channel_is_opchannel(IRC_SERVER_REC *server, const char *target); +const char *fe_channel_skip_prefix(IRC_SERVER_REC *server, const char *target); + +void fe_irc_channels_init(void); +void fe_irc_channels_deinit(void); + +#endif diff --git a/src/fe-common/irc/fe-irc-messages.c b/src/fe-common/irc/fe-irc-messages.c index e8cdb2c4..b2736a2c 100644 --- a/src/fe-common/irc/fe-irc-messages.c +++ b/src/fe-common/irc/fe-irc-messages.c @@ -37,51 +37,6 @@ #include "fe-queries.h" #include "window-items.h" -int fe_channel_is_opchannel(IRC_SERVER_REC *server, const char *target) -{ - const char *statusmsg; - - /* Quick check */ - if (server == NULL || server->prefix[(int)(unsigned char)*target] == 0) - return FALSE; - - statusmsg = g_hash_table_lookup(server->isupport, "statusmsg"); - if (statusmsg == NULL) - statusmsg = "@+"; - - return strchr(statusmsg, *target) != NULL; -} - -const char *fe_channel_skip_prefix(IRC_SERVER_REC *server, const char *target) -{ - const char *statusmsg; - - /* Quick check */ - if (server == NULL || server->prefix[(int)(unsigned char)*target] == 0) - return target; - - /* Exit early if target doesn't name a channel */ - if (server_ischannel(SERVER(server), target) == FALSE) - return FALSE; - - statusmsg = g_hash_table_lookup(server->isupport, "statusmsg"); - - /* Hack: for bahamut 1.4 which sends neither STATUSMSG nor - * WALLCHOPS in 005, accept @#chan and @+#chan (but not +#chan) */ - if (statusmsg == NULL && *target != '@') - return target; - - if (statusmsg == NULL) - statusmsg = "@+"; - - /* Strip the leading statusmsg prefixes */ - while (strchr(statusmsg, *target) != NULL) { - target++; - } - - return target; -} - static void sig_message_own_public(SERVER_REC *server, const char *msg, const char *target, const char *origtarget) { |