diff options
author | Timo Sirainen <cras@irssi.org> | 2001-01-01 16:57:25 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2001-01-01 16:57:25 +0000 |
commit | 2ae679be088b0c726bf1c482fd22ee3231c94349 (patch) | |
tree | 804506241870ee73d6506c731a4e72f7f7d90e1b /src/core/expandos.c | |
parent | 219c83ae6ab83e546fe18bc697ef3a1ab3d12caa (diff) | |
download | irssi-2ae679be088b0c726bf1c482fd22ee3231c94349.zip |
added "message own_public" and "message own_private" events that are
sent when /msg command is used. this way we don't need to parse the
/msg's options everywhere. also efnet @#channels support works now better.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1041 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/core/expandos.c')
-rw-r--r-- | src/core/expandos.c | 42 |
1 files changed, 17 insertions, 25 deletions
diff --git a/src/core/expandos.c b/src/core/expandos.c index 006dd443..a0fd3a28 100644 --- a/src/core/expandos.c +++ b/src/core/expandos.c @@ -391,13 +391,6 @@ static char *expando_chatnet(SERVER_REC *server, void *item, int *free_ret) return server == NULL ? "" : server->connrec->chatnet; } -static void sig_message_private(SERVER_REC *server, const char *msg, - const char *nick, const char *address) -{ - g_free_not_null(last_privmsg_from); - last_privmsg_from = g_strdup(nick); -} - static void sig_message_public(SERVER_REC *server, const char *msg, const char *nick, const char *address, const char *target) @@ -406,28 +399,27 @@ static void sig_message_public(SERVER_REC *server, const char *msg, last_public_from = g_strdup(nick); } -static void cmd_msg(const char *data, SERVER_REC *server) +static void sig_message_private(SERVER_REC *server, const char *msg, + const char *nick, const char *address) { - GHashTable *optlist; - char *target, *msg; - void *free_arg; - - g_return_if_fail(data != NULL); + g_free_not_null(last_privmsg_from); + last_privmsg_from = g_strdup(nick); +} - if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_OPTIONS | - PARAM_FLAG_UNKNOWN_OPTIONS | PARAM_FLAG_GETREST, - "msg", &optlist, &target, &msg)) - return; +static void sig_message_own_private(SERVER_REC *server, const char *msg, + const char *target, const char *origtarget) +{ + g_return_if_fail(server != NULL); + g_return_if_fail(msg != NULL); - if (*target != '\0' && *msg != '\0' && - !server->ischannel(*target) && isalpha(*target)) { - g_free_not_null(last_sent_msg); + if (target != NULL) { + if (target != last_sent_msg) { + g_free_not_null(last_sent_msg); + last_sent_msg = g_strdup(target); + } g_free_not_null(last_sent_msg_body); - last_sent_msg = g_strdup(target); last_sent_msg_body = g_strdup(msg); } - - cmd_params_free(free_arg); } static int sig_timer(void) @@ -532,9 +524,9 @@ void expandos_init(void) "window server changed", EXPANDO_ARG_WINDOW, NULL); timer_tag = g_timeout_add(1000, (GSourceFunc) sig_timer, NULL); - signal_add("command msg", (SIGNAL_FUNC) cmd_msg); signal_add("message public", (SIGNAL_FUNC) sig_message_public); signal_add("message private", (SIGNAL_FUNC) sig_message_private); + signal_add("message own_private", (SIGNAL_FUNC) sig_message_own_private); } void expandos_deinit(void) @@ -559,5 +551,5 @@ void expandos_deinit(void) g_source_remove(timer_tag); signal_remove("message public", (SIGNAL_FUNC) sig_message_public); signal_remove("message private", (SIGNAL_FUNC) sig_message_private); - signal_remove("command msg", (SIGNAL_FUNC) cmd_msg); + signal_remove("message own_private", (SIGNAL_FUNC) sig_message_own_private); } |