Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Process the nick changes in queries before the PRIVMSG is handled. #586

Merged
merged 1 commit into from Jan 2, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/fe-common/irc/fe-irc-queries.c
Expand Up @@ -78,6 +78,13 @@ static void event_privmsg(SERVER_REC *server, const char *data,
if (!server_has_nick(server, query->name))
query_change_nick(query, nick);
}
} else {
/* process the changes to the query structure now, before the
* privmsg is dispatched. */
if (g_strcmp0(query->name, nick) != 0)
query_change_nick(query, nick);
if (address != NULL && g_strcmp0(query->address, address) != 0)
query_change_address(query, address);
}
}

Expand Down
16 changes: 0 additions & 16 deletions src/irc/core/irc-queries.c
Expand Up @@ -79,20 +79,6 @@ static void check_query_changes(IRC_SERVER_REC *server, const char *nick,
}
}

static void event_privmsg(IRC_SERVER_REC *server, const char *data,
const char *nick, const char *address)
{
char *params, *target, *msg;

g_return_if_fail(data != NULL);
if (nick == NULL)
return;

params = event_get_params(data, 2 | PARAM_FLAG_GETREST, &target, &msg);
check_query_changes(server, nick, address, target);
g_free(params);
}

static void ctcp_action(IRC_SERVER_REC *server, const char *msg,
const char *nick, const char *address,
const char *target)
Expand All @@ -117,14 +103,12 @@ static void event_nick(SERVER_REC *server, const char *data,

void irc_queries_init(void)
{
signal_add_last("event privmsg", (SIGNAL_FUNC) event_privmsg);
signal_add_last("ctcp action", (SIGNAL_FUNC) ctcp_action);
signal_add("event nick", (SIGNAL_FUNC) event_nick);
}

void irc_queries_deinit(void)
{
signal_remove("event privmsg", (SIGNAL_FUNC) event_privmsg);
signal_remove("ctcp action", (SIGNAL_FUNC) ctcp_action);
signal_remove("event nick", (SIGNAL_FUNC) event_nick);
}