summaryrefslogtreecommitdiff
path: root/src/irc
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2001-05-11 15:48:09 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2001-05-11 15:48:09 +0000
commite3b33796ff29574e3c91c07e2aa3d669b3cd4760 (patch)
tree903e10b4fd3db5654d86f502bb7a31ef302299b5 /src/irc
parentd44b803c3cb14d6ea94b90fc6c9f74e05854062a (diff)
downloadirssi-e3b33796ff29574e3c91c07e2aa3d669b3cd4760.zip
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
Diffstat (limited to 'src/irc')
-rw-r--r--src/irc/core/irc.c36
-rw-r--r--src/irc/core/irc.h6
2 files changed, 1 insertions, 41 deletions
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, ...);