From 0b76888e5424179b91b58961594c736f060e0116 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 14 Jun 2007 23:55:48 +0200 Subject: [PATCH] Handle 354 replies correctly. --- NEWS | 2 ++ src/cache.c | 3 +++ src/irc.h | 1 + src/redirect.c | 2 +- src/repl.c | 6 +++--- src/settings.c | 2 +- src/state.c | 2 +- 7 files changed, 12 insertions(+), 6 deletions(-) diff --git a/NEWS b/NEWS index c9e2f74..5acc3a2 100644 --- a/NEWS +++ b/NEWS @@ -18,6 +18,8 @@ Ctrlproxy 3.0.3 UNRELEASED * Don't update config when we're disconnecting during shutdown. (#113) + * Handle 354 response correctly. (#134) + INTERNALS * Use GIOChannels for reading the motd. diff --git a/src/cache.c b/src/cache.c index 060f059..e9d5004 100644 --- a/src/cache.c +++ b/src/cache.c @@ -172,6 +172,9 @@ static gboolean client_try_cache_who(struct client *c, struct line *l) if (strchr(l->args[1], ',')) return FALSE; if (strchr(l->args[1], '*')) return FALSE; + /* Don't cache complex requests.. for now */ + if (l->argc > 2) return FALSE; + max_who_age = c->network->global->config->max_who_age; /* Never cache when max_who_age is set to 0 */ diff --git a/src/irc.h b/src/irc.h index 0b3e1c2..5ce6403 100644 --- a/src/irc.h +++ b/src/irc.h @@ -111,6 +111,7 @@ #define RPL_WHOREPLY 352 #define RPL_ENDOFWHO 315 #define RPL_NAMREPLY 353 +#define RPL_WHOSPCRPL 354 #define RPL_ENDOFNAMES 366 #define RPL_LINKS 364 #define RPL_ENDOFLINKS 365 diff --git a/src/redirect.c b/src/redirect.c index 22a4f9d..f4f1b86 100644 --- a/src/redirect.c +++ b/src/redirect.c @@ -65,7 +65,7 @@ static struct query queries[] = { /* WHO [ []] */ {"WHO", - { RPL_WHOREPLY, 0 }, + { RPL_WHOREPLY, RPL_WHOSPCRPL, 0 }, { RPL_ENDOFWHO, 0 }, { ERR_NOSUCHSERVER, 0 }, handle_default diff --git a/src/repl.c b/src/repl.c index 547695e..8a6649f 100644 --- a/src/repl.c +++ b/src/repl.c @@ -105,8 +105,8 @@ gboolean client_send_state(struct client *c, struct network_state *state) c->nick = g_strdup(state->me.nick); } - g_assert(c); - g_assert(state); + g_assert(c != NULL); + g_assert(state != NULL); log_client(LOG_TRACE, c, "Sending state (%d channels)", g_list_length(state->channels)); @@ -118,7 +118,7 @@ gboolean client_send_state(struct client *c, struct network_state *state) } mode = mode2string(state->me.modes); - if (mode) + if (mode != NULL) client_send_args_ex(c, state->me.nick, "MODE", mode, NULL); g_free(mode); diff --git a/src/settings.c b/src/settings.c index 379e447..02309f5 100644 --- a/src/settings.c +++ b/src/settings.c @@ -505,7 +505,7 @@ struct ctrlproxy_config *load_configuration(const char *dir) if (g_key_file_has_key(kf, "client", "charset", NULL)) cfg->client_charset = g_key_file_get_string(kf, "client", "charset", NULL); else - cfg->client_charset = g_strdup(DEFAULT_CLIENT_CHARSET); + cfg->client_charset = NULL; if(!g_file_test(cfg->motd_file, G_FILE_TEST_EXISTS)) log_global(LOG_ERROR, "Can't open MOTD file '%s' for reading", cfg->motd_file); diff --git a/src/state.c b/src/state.c index 711a612..dd8f1f1 100644 --- a/src/state.c +++ b/src/state.c @@ -468,7 +468,7 @@ static void handle_333(struct network_state *s, struct line *l) return; } - c->topic_set_time = atoi(l->args[4]); + c->topic_set_time = atol(l->args[4]); c->topic_set_by = g_strdup(l->args[3]); } -- 2.34.1