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:
Timo Sirainen 2002-05-16 00:34:37 +00:00 committed by cras
commit d346fbe1a9
44 changed files with 325 additions and 247 deletions

View file

@ -23,6 +23,7 @@
#include "modules.h"
#include "signals.h"
#include "servers.h"
#include "channels.h"
#include "settings.h"
#include "levels.h"
@ -195,15 +196,23 @@ void window_item_next(WINDOW_REC *window)
WI_ITEM_REC *window_item_find_window(WINDOW_REC *window,
void *server, const char *name)
{
CHANNEL_REC *channel;
GSList *tmp;
for (tmp = window->items; tmp != NULL; tmp = tmp->next) {
WI_ITEM_REC *rec = tmp->data;
if ((server == NULL || rec->server == server) &&
g_strcasecmp(name, rec->name) == 0) return rec;
g_strcasecmp(name, rec->visible_name) == 0)
return rec;
}
/* try with channel name too, it's not necessarily
same as visible_name (!channels) */
channel = channel_find(server, name);
if (channel != NULL && window_item_window(channel) == window)
return (WI_ITEM_REC *) channel;
return NULL;
}
@ -259,7 +268,7 @@ void window_item_create(WI_ITEM_REC *item, int automatic)
/* is item bound to this window? */
if (item->server != NULL) {
bind = window_bind_find(rec, item->server->tag,
item->name);
item->visible_name);
if (bind != NULL) {
if (!bind->sticky)
window_bind_destroy(rec, bind);
@ -316,8 +325,9 @@ static void signal_window_item_changed(WINDOW_REC *window, WI_ITEM_REC *item)
if (g_slist_length(window->items) > 1) {
/* default to printing "talking with ...",
you can override it it you wish */
printformat(item->server, item->name, MSGLEVEL_CLIENTNOTICE,
TXT_TALKING_WITH, item->name);
printformat(item->server, item->visible_name,
MSGLEVEL_CLIENTNOTICE,
TXT_TALKING_WITH, item->visible_name);
}
}