aboutsummaryrefslogtreecommitdiff
path: root/degesch.c
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2015-06-02 20:46:40 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2015-06-02 20:46:40 +0200
commit00a8b6616f95e119e5d713cd875d0f411cb3ddfa (patch)
tree372d8ed454333ed13c874fe41569ef7ecef38d6c /degesch.c
parent57413d53a42bd01c39a0665a0daa4f94f45df654 (diff)
downloadxK-00a8b6616f95e119e5d713cd875d0f411cb3ddfa.tar.gz
xK-00a8b6616f95e119e5d713cd875d0f411cb3ddfa.tar.xz
xK-00a8b6616f95e119e5d713cd875d0f411cb3ddfa.zip
degesch: add & use irc_server_strcmp()
Diffstat (limited to 'degesch.c')
-rw-r--r--degesch.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/degesch.c b/degesch.c
index d16b6af..23d5124 100644
--- a/degesch.c
+++ b/degesch.c
@@ -1045,7 +1045,6 @@ struct server
// Server-specific information (from RPL_ISUPPORT):
- // TODO: implement a generic strcmp() on top of "irc_tolower"
/// Convert an IRC identifier character to lower-case
int (*irc_tolower) (int);
@@ -3647,6 +3646,16 @@ refresh_prompt (struct app_context *ctx)
// --- Helpers -----------------------------------------------------------------
+static int
+irc_server_strcmp (struct server *s, const char *a, const char *b)
+{
+ int x;
+ while (*a || *b)
+ if ((x = s->irc_tolower (*a++) - s->irc_tolower (*b++)))
+ return x;
+ return 0;
+}
+
static char *
irc_cut_nickname (const char *prefix)
{
@@ -3669,7 +3678,7 @@ irc_is_this_us (struct server *s, const char *prefix)
return false;
char *nick = irc_cut_nickname (prefix);
- bool result = !irc_strcmp (nick, s->irc_user->nickname);
+ bool result = !irc_server_strcmp (s, nick, s->irc_user->nickname);
free (nick);
return result;
}