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
|
|
@ -44,21 +44,37 @@ void irc_channels_setup_deinit(void);
|
|||
void massjoin_init(void);
|
||||
void massjoin_deinit(void);
|
||||
|
||||
IRC_CHANNEL_REC *irc_channel_create(IRC_SERVER_REC *server,
|
||||
const char *name, int automatic)
|
||||
IRC_CHANNEL_REC *irc_channel_create(IRC_SERVER_REC *server, const char *name,
|
||||
const char *visible_name, int automatic)
|
||||
{
|
||||
IRC_CHANNEL_REC *rec;
|
||||
char *new_name;
|
||||
|
||||
g_return_val_if_fail(server == NULL || IS_IRC_SERVER(server), NULL);
|
||||
g_return_val_if_fail(name != NULL, NULL);
|
||||
|
||||
rec = g_new0(IRC_CHANNEL_REC, 1);
|
||||
rec->chat_type = IRC_PROTOCOL;
|
||||
rec->name = g_strdup(name);
|
||||
rec->server = server;
|
||||
if (*name == '+') rec->no_modes = TRUE;
|
||||
|
||||
channel_init((CHANNEL_REC *) rec, automatic);
|
||||
new_name = NULL;
|
||||
if (visible_name == NULL) {
|
||||
/* !?????channel -> !channel */
|
||||
new_name = *name == '!' && strlen(name) >= 1+5 ?
|
||||
g_strconcat("!", name+1+5, NULL) :
|
||||
g_strdup(name);
|
||||
|
||||
if (irc_channel_find(server, new_name) != NULL) {
|
||||
/* this was second !channel with same name,
|
||||
show the channel id after all */
|
||||
g_free_and_null(new_name);
|
||||
}
|
||||
|
||||
visible_name = new_name;
|
||||
}
|
||||
|
||||
channel_init((CHANNEL_REC *) rec, (SERVER_REC *) server,
|
||||
name, visible_name, automatic);
|
||||
g_free(new_name);
|
||||
return rec;
|
||||
}
|
||||
|
||||
|
|
@ -112,7 +128,7 @@ static void irc_channels_join(IRC_SERVER_REC *server, const char *data,
|
|||
g_string_sprintfa(outkeys, "%s,", get_join_key(key));
|
||||
channame = channel + (channel[0] == '!' &&
|
||||
channel[1] == '!');
|
||||
chanrec = irc_channel_create(server, channame,
|
||||
chanrec = irc_channel_create(server, channame, NULL,
|
||||
automatic);
|
||||
if (key != NULL) chanrec->key = g_strdup(key);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue