mirror of
https://github.com/irssi/irssi.git
synced 2026-08-19 08:32:07 +02:00
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
This commit is contained in:
parent
ee80e7601a
commit
d346fbe1a9
44 changed files with 325 additions and 247 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue