From bdb5c3eb9ddafff656953ff048b6b3bbb3234181 Mon Sep 17 00:00:00 2001 From: TingPing Date: Fri, 12 Dec 2014 05:15:49 -0500 Subject: fishlim: Use hexchat_nickcmp() --- plugins/fishlim/irc.c | 26 -------------------------- plugins/fishlim/irc.h | 1 - plugins/fishlim/plugin_hexchat.c | 4 ++++ plugins/fishlim/plugin_hexchat.h | 1 + 4 files changed, 5 insertions(+), 27 deletions(-) diff --git a/plugins/fishlim/irc.c b/plugins/fishlim/irc.c index c80fc1c9..2ed23f41 100644 --- a/plugins/fishlim/irc.c +++ b/plugins/fishlim/irc.c @@ -76,29 +76,3 @@ char *irc_prefix_get_nick(const char *prefix) { length = end - prefix; return g_strndup (prefix, length); } - - -/** - * Compares two nick names. Return 0 if equal. Otherwise the return value is - * less than zero if a is less than b or greater than zero if a is greater - * than b. - */ -int irc_nick_cmp(const char *a, const char *b) { - char ac; - char bc; - char diff; - for (;;) { - ac = *(a++); - bc = *(b++); - - // Change into IRC uppercase (see RFC 2812 section 2.2) - if (ac >= 'a' && ac <= '~') ac &= ~0x20; - if (bc >= 'a' && bc <= '~') bc &= ~0x20; - - diff = ac - bc; - if (diff) return diff; - if (!ac) return 0; - } -} - - diff --git a/plugins/fishlim/irc.h b/plugins/fishlim/irc.h index 87317130..dc43185c 100644 --- a/plugins/fishlim/irc.h +++ b/plugins/fishlim/irc.h @@ -32,7 +32,6 @@ bool irc_parse_message(const char *words[], const char **prefix, const char **command, size_t *parameters_offset); char *irc_prefix_get_nick(const char *prefix); -int irc_nick_cmp(const char *a, const char *b); #endif diff --git a/plugins/fishlim/plugin_hexchat.c b/plugins/fishlim/plugin_hexchat.c index 8f2536ce..0219e5fa 100644 --- a/plugins/fishlim/plugin_hexchat.c +++ b/plugins/fishlim/plugin_hexchat.c @@ -55,6 +55,10 @@ gchar *get_config_filename() { return g_build_filename(hexchat_get_info(ph, "configdir"), "addon_fishlim.conf", NULL); } +int irc_nick_cmp(const char *a, const char *b) { + return hexchat_nickcmp (ph, a, b); +} + /*static int handle_debug(char *word[], char *word_eol[], void *userdata) { hexchat_printf(ph, "debug incoming: "); for (size_t i = 1; word[i] != NULL && word[i][0] != '\0'; i++) { diff --git a/plugins/fishlim/plugin_hexchat.h b/plugins/fishlim/plugin_hexchat.h index 04a1f4ff..f60522e6 100644 --- a/plugins/fishlim/plugin_hexchat.h +++ b/plugins/fishlim/plugin_hexchat.h @@ -26,6 +26,7 @@ #define PLUGIN_HEXCHAT_H gchar *get_config_filename(); +int irc_nick_cmp (const char *, const char *); #endif -- cgit 1.4.1