diff options
author | Timo Sirainen <cras@irssi.org> | 2002-05-16 00:34:37 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2002-05-16 00:34:37 +0000 |
commit | d346fbe1a9c6615c88dfacc420f0256b5a751440 (patch) | |
tree | 2afa5956d03f670310bb45e019c2259b2ba46a10 /src/core/commands.c | |
parent | ee80e7601a0e664525cfc1f47bf90f30c93512d4 (diff) | |
download | irssi-d346fbe1a9c6615c88dfacc420f0256b5a751440.zip |
Better !channel support - window items now have "visual_name" and channels
and queries also have "name". Normally they're identical but with !channels
the visible_name contains the short !channel name, while name contains
full !ABCDEchannel name.
The visible_name should be used whenever displaying the channel name, or as
printtext()'s target. So, this breaks a few scripts in !channels, they need
to be modified to use $channel->{visible_name} instead.
Also /LAYOUT SAVE should finally work properly with !channels.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2797 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/core/commands.c')
-rw-r--r-- | src/core/commands.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/core/commands.c b/src/core/commands.c index 96a74008..91e4a170 100644 --- a/src/core/commands.c +++ b/src/core/commands.c @@ -653,11 +653,12 @@ typedef struct { GHashTable *options; } CMD_TEMP_REC; -static char *get_optional_channel(WI_ITEM_REC *active_item, char **data, - int require_name) +static const char * +get_optional_channel(WI_ITEM_REC *active_item, char **data, int require_name) { CHANNEL_REC *chanrec; - char *tmp, *origtmp, *channel, *ret; + const char *ret; + char *tmp, *origtmp, *channel; if (active_item == NULL) { /* no active channel in window, channel required */ @@ -670,10 +671,10 @@ static char *get_optional_channel(WI_ITEM_REC *active_item, char **data, if (strcmp(channel, "*") == 0 && !require_name) { /* "*" means active channel */ cmd_get_param(data); - ret = active_item->name; + ret = window_item_get_target(active_item); } else if (!server_ischannel(active_item->server, channel)) { /* we don't have channel parameter - use active channel */ - ret = active_item->name; + ret = window_item_get_target(active_item); } else { /* Find the channel first and use it's name if found. This allows automatic !channel -> !XXXXXchannel replaces. */ @@ -730,7 +731,7 @@ int cmd_get_params(const char *data, gpointer *free_me, int count, ...) /* optional channel as first parameter */ require_name = (count & PARAM_FLAG_OPTCHAN_NAME) == PARAM_FLAG_OPTCHAN_NAME; - arg = get_optional_channel(item, &datad, require_name); + arg = (char *) get_optional_channel(item, &datad, require_name); str = (char **) va_arg(args, char **); if (str != NULL) *str = arg; |