From e3b33796ff29574e3c91c07e2aa3d669b3cd4760 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Fri, 11 May 2001 15:48:09 +0000 Subject: Moved PARAM_FLAG_OPTCHAN handling to core. Removed support for adding own command parameter parsers, it's probably useless now that opt.channels are in core. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1482 dbcabf3a-b0e7-0310-adc4-f8d773084564 --- src/irc/core/irc.c | 36 ------------------------------------ src/irc/core/irc.h | 6 +----- 2 files changed, 1 insertion(+), 41 deletions(-) (limited to 'src/irc') diff --git a/src/irc/core/irc.c b/src/irc/core/irc.c index 7af48fe2..e3ba24a2 100644 --- a/src/irc/core/irc.c +++ b/src/irc/core/irc.c @@ -377,44 +377,8 @@ static void irc_init_server(IRC_SERVER_REC *server) (GInputFunction) irc_parse_incoming, server); } -#define isoptchan(a) \ - (ischannel((a)[0]) || ((a)[0] == '*' && ((a)[1] == '\0' || (a)[1] == ' '))) - -static char *irc_cmd_get_func(const char *data, int *count, va_list *vargs) -{ - IRC_CHANNEL_REC *channel; - char *ret, *args, *chan, *p; - - if ((*count & PARAM_FLAG_OPTCHAN) == 0) - return g_strdup(data); - - *count &= ~PARAM_FLAG_OPTCHAN; - channel = (void *) va_arg(*vargs, void *); - channel = IRC_CHANNEL(channel); - - /* change first argument in data to full channel name. */ - p = args = g_strdup(data); - - chan = isoptchan(args) ? cmd_get_param(&args) : NULL; - if (chan != NULL && *chan == '!' && channel != NULL) { - /* whenever trying to send something to !channel, - change it to the real joined !XXXXXchannel */ - channel = irc_channel_find(channel->server, chan); - if (channel != NULL) chan = channel->name; - } - - if (chan == NULL || strcmp(chan, "*") == 0) - chan = channel == NULL ? "*" : channel->name; - - ret = g_strconcat(chan, " ", args, NULL); - g_free(p); - return ret; -} - void irc_irc_init(void) { - cmd_get_add_func(irc_cmd_get_func); - signal_add("server event", (SIGNAL_FUNC) irc_server_event); signal_add("server connected", (SIGNAL_FUNC) irc_init_server); signal_add("server incoming", (SIGNAL_FUNC) irc_parse_incoming_line); diff --git a/src/irc/core/irc.h b/src/irc/core/irc.h index c4e4ed10..17a18635 100644 --- a/src/irc/core/irc.h +++ b/src/irc/core/irc.h @@ -50,12 +50,8 @@ void irc_send_cmd_now(IRC_SERVER_REC *server, const char *cmd); void irc_send_cmd_full(IRC_SERVER_REC *server, const char *cmd, int send_now, int immediate, int raw); -#include "commands.h" /* contains the generic PARAM_FLAG_xxx defines */ - -/* IRC specific: optional channel in first argument */ -#define PARAM_FLAG_OPTCHAN 0x10000000 - /* Get count parameters from data */ +#include "commands.h" char *event_get_param(char **data); char *event_get_params(const char *data, int count, ...); -- cgit v1.2.3