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

@ -27,6 +27,11 @@
GSList *queries;
static const char *query_get_target(WI_ITEM_REC *item)
{
return ((QUERY_REC *) item)->name;
}
void query_init(QUERY_REC *query, int automatic)
{
g_return_if_fail(query != NULL);
@ -37,8 +42,10 @@ void query_init(QUERY_REC *query, int automatic)
MODULE_DATA_INIT(query);
query->type = module_get_uniq_id_str("WINDOW ITEM TYPE", "QUERY");
query->destroy = (void (*) (WI_ITEM_REC *)) query_destroy;
query->get_target = query_get_target;
query->createtime = time(NULL);
query->last_unread_msg = time(NULL);
query->visible_name = g_strdup(query->name);
if (query->server_tag != NULL) {
query->server = server_find_tag(query->server_tag);
@ -69,6 +76,7 @@ void query_destroy(QUERY_REC *query)
g_free_not_null(query->hilight_color);
g_free_not_null(query->server_tag);
g_free_not_null(query->address);
g_free(query->visible_name);
g_free(query->name);
query->type = 0;
@ -124,6 +132,10 @@ void query_change_nick(QUERY_REC *query, const char *nick)
oldnick = query->name;
query->name = g_strdup(nick);
g_free(query->visible_name);
query->visible_name = g_strdup(nick);
signal_emit("query nick changed", 2, query, oldnick);
signal_emit("window item name changed", 1, query);
g_free(oldnick);