mirror of
https://github.com/irssi/irssi.git
synced 2026-08-10 04:13:32 +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
|
|
@ -14,7 +14,6 @@ INCLUDES = \
|
|||
real_sources = \
|
||||
fe-irc-channels.c \
|
||||
fe-irc-commands.c \
|
||||
fe-irc-layout.c \
|
||||
fe-irc-messages.c \
|
||||
fe-irc-queries.c \
|
||||
fe-irc-server.c \
|
||||
|
|
@ -33,6 +32,7 @@ libfe_common_irc_a_SOURCES = \
|
|||
irc-modules.c
|
||||
|
||||
noinst_HEADERS = \
|
||||
fe-irc-server.h \
|
||||
module.h \
|
||||
module-formats.h
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
#include "settings.h"
|
||||
|
||||
#include "themes.h"
|
||||
#include "fe-irc-server.h"
|
||||
|
||||
void fe_irc_modules_init(void);
|
||||
void fe_irc_modules_deinit(void);
|
||||
|
|
@ -49,9 +50,6 @@ void fe_irc_commands_deinit(void);
|
|||
void fe_ircnet_init(void);
|
||||
void fe_ircnet_deinit(void);
|
||||
|
||||
void fe_irc_server_init(void);
|
||||
void fe_irc_server_deinit(void);
|
||||
|
||||
void fe_ctcp_init(void);
|
||||
void fe_ctcp_deinit(void);
|
||||
|
||||
|
|
@ -78,7 +76,6 @@ void fe_common_irc_init(void)
|
|||
|
||||
fe_irc_channels_init();
|
||||
fe_irc_queries_init();
|
||||
fe_irc_layout_init();
|
||||
fe_irc_messages_init();
|
||||
fe_irc_commands_init();
|
||||
fe_ircnet_init();
|
||||
|
|
@ -102,7 +99,6 @@ void fe_common_irc_deinit(void)
|
|||
|
||||
fe_irc_channels_deinit();
|
||||
fe_irc_queries_deinit();
|
||||
fe_irc_layout_deinit();
|
||||
fe_irc_messages_deinit();
|
||||
fe_irc_commands_deinit();
|
||||
fe_ircnet_deinit();
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@
|
|||
#include "../core/module-formats.h"
|
||||
#include "printtext.h"
|
||||
#include "fe-channels.h"
|
||||
#include "fe-irc-server.h"
|
||||
|
||||
static void print_event_received(IRC_SERVER_REC *server, const char *data,
|
||||
const char *nick, int target_param);
|
||||
|
|
@ -132,7 +133,8 @@ static void event_end_of_who(IRC_SERVER_REC *server, const char *data)
|
|||
|
||||
static void event_ban_list(IRC_SERVER_REC *server, const char *data)
|
||||
{
|
||||
char *params, *channel, *ban, *setby, *tims;
|
||||
const char *channel;
|
||||
char *params, *ban, *setby, *tims;
|
||||
long secs;
|
||||
|
||||
g_return_if_fail(data != NULL);
|
||||
|
|
@ -142,6 +144,7 @@ static void event_ban_list(IRC_SERVER_REC *server, const char *data)
|
|||
secs = *tims == '\0' ? 0 :
|
||||
(long) (time(NULL) - atol(tims));
|
||||
|
||||
channel = get_visible_target(server, channel);
|
||||
printformat(server, channel, MSGLEVEL_CRAP,
|
||||
*setby == '\0' ? IRCTXT_BANLIST : IRCTXT_BANLIST_LONG,
|
||||
0, channel, ban, setby, secs);
|
||||
|
|
@ -151,7 +154,8 @@ static void event_ban_list(IRC_SERVER_REC *server, const char *data)
|
|||
|
||||
static void event_eban_list(IRC_SERVER_REC *server, const char *data)
|
||||
{
|
||||
char *params, *channel, *ban, *setby, *tims;
|
||||
const char *channel;
|
||||
char *params, *ban, *setby, *tims;
|
||||
long secs;
|
||||
|
||||
g_return_if_fail(data != NULL);
|
||||
|
|
@ -161,6 +165,7 @@ static void event_eban_list(IRC_SERVER_REC *server, const char *data)
|
|||
secs = *tims == '\0' ? 0 :
|
||||
(long) (time(NULL) - atol(tims));
|
||||
|
||||
channel = get_visible_target(server, channel);
|
||||
printformat(server, channel, MSGLEVEL_CRAP,
|
||||
*setby == '\0' ? IRCTXT_EBANLIST : IRCTXT_EBANLIST_LONG,
|
||||
channel, ban, setby, secs);
|
||||
|
|
@ -183,11 +188,13 @@ static void event_silence_list(IRC_SERVER_REC *server, const char *data)
|
|||
|
||||
static void event_invite_list(IRC_SERVER_REC *server, const char *data)
|
||||
{
|
||||
char *params, *channel, *invite;
|
||||
const char *channel;
|
||||
char *params, *invite;
|
||||
|
||||
g_return_if_fail(data != NULL);
|
||||
|
||||
params = event_get_params(data, 3, NULL, &channel, &invite);
|
||||
channel = get_visible_target(server, channel);
|
||||
printformat(server, channel, MSGLEVEL_CRAP,
|
||||
IRCTXT_INVITELIST, channel, invite);
|
||||
g_free(params);
|
||||
|
|
@ -210,11 +217,13 @@ static void event_nick_in_use(IRC_SERVER_REC *server, const char *data)
|
|||
|
||||
static void event_topic_get(IRC_SERVER_REC *server, const char *data)
|
||||
{
|
||||
char *params, *channel, *topic;
|
||||
const char *channel;
|
||||
char *params, *topic;
|
||||
|
||||
g_return_if_fail(data != NULL);
|
||||
|
||||
params = event_get_params(data, 3, NULL, &channel, &topic);
|
||||
channel = get_visible_target(server, channel);
|
||||
printformat(server, channel, MSGLEVEL_CRAP,
|
||||
IRCTXT_TOPIC, channel, topic);
|
||||
g_free(params);
|
||||
|
|
@ -222,7 +231,8 @@ static void event_topic_get(IRC_SERVER_REC *server, const char *data)
|
|||
|
||||
static void event_topic_info(IRC_SERVER_REC *server, const char *data)
|
||||
{
|
||||
char *params, *timestr, *channel, *bynick, *byhost, *topictime;
|
||||
const char *channel;
|
||||
char *params, *timestr, *bynick, *byhost, *topictime;
|
||||
|
||||
g_return_if_fail(data != NULL);
|
||||
|
||||
|
|
@ -235,6 +245,7 @@ static void event_topic_info(IRC_SERVER_REC *server, const char *data)
|
|||
if (byhost != NULL)
|
||||
*byhost++ = '\0';
|
||||
|
||||
channel = get_visible_target(server, channel);
|
||||
printformat(server, channel, MSGLEVEL_CRAP, IRCTXT_TOPIC_INFO,
|
||||
bynick, timestr, byhost == NULL ? "" : byhost);
|
||||
g_free(timestr);
|
||||
|
|
@ -243,12 +254,14 @@ static void event_topic_info(IRC_SERVER_REC *server, const char *data)
|
|||
|
||||
static void event_channel_mode(IRC_SERVER_REC *server, const char *data)
|
||||
{
|
||||
char *params, *channel, *mode;
|
||||
const char *channel;
|
||||
char *params, *mode;
|
||||
|
||||
g_return_if_fail(data != NULL);
|
||||
|
||||
params = event_get_params(data, 3 | PARAM_FLAG_GETREST,
|
||||
NULL, &channel, &mode);
|
||||
channel = get_visible_target(server, channel);
|
||||
printformat(server, channel, MSGLEVEL_CRAP,
|
||||
IRCTXT_CHANNEL_MODE, channel, g_strchomp(mode));
|
||||
g_free(params);
|
||||
|
|
@ -256,13 +269,15 @@ static void event_channel_mode(IRC_SERVER_REC *server, const char *data)
|
|||
|
||||
static void event_channel_created(IRC_SERVER_REC *server, const char *data)
|
||||
{
|
||||
char *params, *channel, *createtime, *timestr;
|
||||
const char *channel;
|
||||
char *params, *createtime, *timestr;
|
||||
|
||||
g_return_if_fail(data != NULL);
|
||||
|
||||
params = event_get_params(data, 3, NULL, &channel, &createtime);
|
||||
|
||||
timestr = my_asctime((time_t) atol(createtime));
|
||||
channel = get_visible_target(server, channel);
|
||||
printformat(server, channel, MSGLEVEL_CRAP,
|
||||
IRCTXT_CHANNEL_CREATED, channel, timestr);
|
||||
g_free(timestr);
|
||||
|
|
@ -604,11 +619,13 @@ static void event_end_of_whois(IRC_SERVER_REC *server, const char *data)
|
|||
|
||||
static void event_chanserv_url(IRC_SERVER_REC *server, const char *data)
|
||||
{
|
||||
char *params, *channel, *url;
|
||||
const char *channel;
|
||||
char *params, *url;
|
||||
|
||||
g_return_if_fail(data != NULL);
|
||||
|
||||
params = event_get_params(data, 3, NULL, &channel, &url);
|
||||
channel = get_visible_target(server, channel);
|
||||
printformat(server, channel, MSGLEVEL_CRAP,
|
||||
IRCTXT_CHANNEL_URL, channel, url);
|
||||
g_free(params);
|
||||
|
|
|
|||
|
|
@ -39,8 +39,8 @@
|
|||
#include "printtext.h"
|
||||
#include "fe-queries.h"
|
||||
#include "fe-windows.h"
|
||||
|
||||
#include "completion.h"
|
||||
#include "fe-irc-server.h"
|
||||
//#include "completion.h"
|
||||
|
||||
static void event_privmsg(IRC_SERVER_REC *server, const char *data,
|
||||
const char *nick, const char *addr)
|
||||
|
|
@ -56,11 +56,13 @@ static void event_privmsg(IRC_SERVER_REC *server, const char *data,
|
|||
if (*target == '@' && ischannel(target[1])) {
|
||||
/* Hybrid 6 feature, send msg to all ops in channel */
|
||||
signal_emit("message irc op_public", 5,
|
||||
server, msg, nick, addr, target+1);
|
||||
server, msg, nick, addr,
|
||||
get_visible_target(server, target+1));
|
||||
} else {
|
||||
signal_emit(ischannel(*target) ?
|
||||
"message public" : "message private", 5,
|
||||
server, msg, nick, addr, target);
|
||||
server, msg, nick, addr,
|
||||
get_visible_target(server, target));
|
||||
}
|
||||
|
||||
g_free(params);
|
||||
|
|
@ -73,7 +75,8 @@ static void ctcp_action(IRC_SERVER_REC *server, const char *data,
|
|||
g_return_if_fail(data != NULL);
|
||||
|
||||
signal_emit("message irc action", 5,
|
||||
server, data, nick, addr, target);
|
||||
server, data, nick, addr,
|
||||
get_visible_target(server, target));
|
||||
}
|
||||
|
||||
static void event_notice(IRC_SERVER_REC *server, const char *data,
|
||||
|
|
@ -90,15 +93,16 @@ static void event_notice(IRC_SERVER_REC *server, const char *data,
|
|||
server->real_address;
|
||||
}
|
||||
|
||||
signal_emit("message irc notice", 5,
|
||||
server, msg, nick, addr, target);
|
||||
signal_emit("message irc notice", 5, server, msg, nick, addr,
|
||||
get_visible_target(server, target));
|
||||
g_free(params);
|
||||
}
|
||||
|
||||
static void event_join(IRC_SERVER_REC *server, const char *data,
|
||||
const char *nick, const char *addr)
|
||||
{
|
||||
char *params, *channel, *tmp;
|
||||
const char *channel;
|
||||
char *params, *tmp;
|
||||
|
||||
g_return_if_fail(data != NULL);
|
||||
|
||||
|
|
@ -106,6 +110,9 @@ static void event_join(IRC_SERVER_REC *server, const char *data,
|
|||
tmp = strchr(channel, 7); /* ^G does something weird.. */
|
||||
if (tmp != NULL) *tmp = '\0';
|
||||
|
||||
if (g_strcasecmp(server->nick, nick) != 0)
|
||||
channel = get_visible_target(server, channel);
|
||||
|
||||
signal_emit("message join", 4, server, channel, nick, addr);
|
||||
g_free(params);
|
||||
}
|
||||
|
|
@ -119,7 +126,8 @@ static void event_part(IRC_SERVER_REC *server, const char *data,
|
|||
|
||||
params = event_get_params(data, 2 | PARAM_FLAG_GETREST,
|
||||
&channel, &reason);
|
||||
signal_emit("message part", 5, server, channel, nick, addr, reason);
|
||||
signal_emit("message part", 5, server,
|
||||
get_visible_target(server, channel), nick, addr, reason);
|
||||
g_free(params);
|
||||
}
|
||||
|
||||
|
|
@ -141,8 +149,9 @@ static void event_kick(IRC_SERVER_REC *server, const char *data,
|
|||
|
||||
params = event_get_params(data, 3 | PARAM_FLAG_GETREST,
|
||||
&channel, &nick, &reason);
|
||||
signal_emit("message kick", 6, server, channel, nick,
|
||||
kicker, addr, reason);
|
||||
signal_emit("message kick", 6,
|
||||
server, get_visible_target(server, channel),
|
||||
nick, kicker, addr, reason);
|
||||
g_free(params);
|
||||
}
|
||||
|
||||
|
|
@ -205,8 +214,9 @@ static void event_mode(IRC_SERVER_REC *server, const char *data,
|
|||
params = event_get_params(data, 2 | PARAM_FLAG_GETREST,
|
||||
&channel, &mode);
|
||||
|
||||
signal_emit("message irc mode", 5, server, channel, nick, addr,
|
||||
g_strchomp(mode));
|
||||
signal_emit("message irc mode", 5,
|
||||
server, get_visible_target(server, channel),
|
||||
nick, addr, g_strchomp(mode));
|
||||
g_free(params);
|
||||
}
|
||||
|
||||
|
|
@ -230,7 +240,8 @@ static void event_invite(IRC_SERVER_REC *server, const char *data,
|
|||
g_return_if_fail(data != NULL);
|
||||
|
||||
params = event_get_params(data, 2, NULL, &channel);
|
||||
signal_emit("message invite", 4, server, channel, nick, addr);
|
||||
signal_emit("message invite", 4,
|
||||
server, get_visible_target(server, channel), nick, addr);
|
||||
g_free(params);
|
||||
}
|
||||
|
||||
|
|
@ -243,7 +254,8 @@ static void event_topic(IRC_SERVER_REC *server, const char *data,
|
|||
|
||||
params = event_get_params(data, 2 | PARAM_FLAG_GETREST,
|
||||
&channel, &topic);
|
||||
signal_emit("message topic", 5, server, channel, topic, nick, addr);
|
||||
signal_emit("message topic", 5, server,
|
||||
get_visible_target(server, channel), topic, nick, addr);
|
||||
g_free(params);
|
||||
}
|
||||
|
||||
|
|
@ -291,8 +303,10 @@ static void channel_sync(CHANNEL_REC *channel)
|
|||
{
|
||||
g_return_if_fail(channel != NULL);
|
||||
|
||||
printformat(channel->server, channel->name, MSGLEVEL_CLIENTNOTICE|MSGLEVEL_NO_ACT,
|
||||
IRCTXT_CHANNEL_SYNCED, channel->name, (long) (time(NULL)-channel->createtime));
|
||||
printformat(channel->server, channel->visible_name,
|
||||
MSGLEVEL_CLIENTNOTICE|MSGLEVEL_NO_ACT,
|
||||
IRCTXT_CHANNEL_SYNCED, channel->visible_name,
|
||||
(long) (time(NULL)-channel->createtime));
|
||||
}
|
||||
|
||||
static void event_connected(IRC_SERVER_REC *server)
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@
|
|||
#include "printtext.h"
|
||||
#include "keyboard.h"
|
||||
|
||||
static char *skip_target(char *target)
|
||||
static const char *skip_target(const char *target)
|
||||
{
|
||||
if (*target == '@') {
|
||||
/* @#channel, @+#channel - Hybrid6 / Bahamut features */
|
||||
|
|
@ -63,17 +63,18 @@ static void cmd_me(const char *data, IRC_SERVER_REC *server, WI_ITEM_REC *item)
|
|||
if (server == NULL || !server->connected)
|
||||
cmd_return_error(CMDERR_NOT_CONNECTED);
|
||||
|
||||
signal_emit("message irc own_action", 3, server, data, item->name);
|
||||
signal_emit("message irc own_action", 3, server, data,
|
||||
item->visible_name);
|
||||
|
||||
irc_send_cmdv(server, "PRIVMSG %s :\001ACTION %s\001",
|
||||
item->name, data);
|
||||
window_item_get_target(item), data);
|
||||
}
|
||||
|
||||
/* SYNTAX: ACTION [-<server tag>] <target> <message> */
|
||||
static void cmd_action(const char *data, IRC_SERVER_REC *server)
|
||||
{
|
||||
GHashTable *optlist;
|
||||
char *target, *text;
|
||||
const char *target, *text;
|
||||
void *free_arg;
|
||||
|
||||
CMD_IRC_SERVER(server);
|
||||
|
|
@ -99,7 +100,7 @@ static void cmd_action(const char *data, IRC_SERVER_REC *server)
|
|||
static void cmd_notice(const char *data, IRC_SERVER_REC *server,
|
||||
WI_ITEM_REC *item)
|
||||
{
|
||||
char *target, *msg;
|
||||
const char *target, *msg;
|
||||
void *free_arg;
|
||||
|
||||
CMD_IRC_SERVER(server);
|
||||
|
|
@ -108,7 +109,7 @@ static void cmd_notice(const char *data, IRC_SERVER_REC *server,
|
|||
&target, &msg))
|
||||
return;
|
||||
if (strcmp(target, "*") == 0)
|
||||
target = item == NULL ? "" : item->name;
|
||||
target = item == NULL ? "" : window_item_get_target(item);
|
||||
|
||||
if (*target == '\0' || *msg == '\0')
|
||||
cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);
|
||||
|
|
@ -121,7 +122,8 @@ static void cmd_notice(const char *data, IRC_SERVER_REC *server,
|
|||
static void cmd_ctcp(const char *data, IRC_SERVER_REC *server,
|
||||
WI_ITEM_REC *item)
|
||||
{
|
||||
char *target, *ctcpcmd, *ctcpdata;
|
||||
const char *target;
|
||||
char *ctcpcmd, *ctcpdata;
|
||||
void *free_arg;
|
||||
|
||||
CMD_IRC_SERVER(server);
|
||||
|
|
@ -130,7 +132,7 @@ static void cmd_ctcp(const char *data, IRC_SERVER_REC *server,
|
|||
&target, &ctcpcmd, &ctcpdata))
|
||||
return;
|
||||
if (strcmp(target, "*") == 0)
|
||||
target = item == NULL ? "" : item->name;
|
||||
target = item == NULL ? "" : window_item_get_target(item);
|
||||
if (*target == '\0' || *ctcpcmd == '\0')
|
||||
cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);
|
||||
|
||||
|
|
@ -152,7 +154,7 @@ static void cmd_ctcp(const char *data, IRC_SERVER_REC *server,
|
|||
static void cmd_nctcp(const char *data, IRC_SERVER_REC *server,
|
||||
WI_ITEM_REC *item)
|
||||
{
|
||||
char *target, *text;
|
||||
const char *target, *text;
|
||||
void *free_arg;
|
||||
|
||||
CMD_IRC_SERVER(server);
|
||||
|
|
@ -161,7 +163,7 @@ static void cmd_nctcp(const char *data, IRC_SERVER_REC *server,
|
|||
&target, &text))
|
||||
return;
|
||||
if (strcmp(target, "*") == 0)
|
||||
target = item == NULL ? "" : item->name;
|
||||
target = item == NULL ? "" : window_item_get_target(item);
|
||||
if (*target == '\0' || *text == '\0')
|
||||
cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);
|
||||
|
||||
|
|
@ -174,7 +176,7 @@ static void cmd_wall(const char *data, IRC_SERVER_REC *server,
|
|||
WI_ITEM_REC *item)
|
||||
{
|
||||
IRC_CHANNEL_REC *chanrec;
|
||||
char *channame, *msg;
|
||||
const char *channame, *msg;
|
||||
void *free_arg;
|
||||
|
||||
CMD_IRC_SERVER(server);
|
||||
|
|
@ -187,7 +189,8 @@ static void cmd_wall(const char *data, IRC_SERVER_REC *server,
|
|||
chanrec = irc_channel_find(server, channame);
|
||||
if (chanrec == NULL) cmd_param_error(CMDERR_CHAN_NOT_FOUND);
|
||||
|
||||
signal_emit("message irc own_wall", 3, server, msg, chanrec->name);
|
||||
signal_emit("message irc own_wall", 3, server, msg,
|
||||
chanrec->visible_name);
|
||||
|
||||
cmd_params_free(free_arg);
|
||||
}
|
||||
|
|
@ -234,8 +237,9 @@ static void bans_show_channel(IRC_CHANNEL_REC *channel, IRC_SERVER_REC *server)
|
|||
cmd_return_error(CMDERR_CHAN_NOT_SYNCED);
|
||||
|
||||
if (channel->banlist == NULL) {
|
||||
printformat(server, channel->name, MSGLEVEL_CLIENTNOTICE,
|
||||
IRCTXT_NO_BANS, channel->name);
|
||||
printformat(server, channel->visible_name,
|
||||
MSGLEVEL_CLIENTNOTICE,
|
||||
IRCTXT_NO_BANS, channel->visible_name);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -244,10 +248,11 @@ static void bans_show_channel(IRC_CHANNEL_REC *channel, IRC_SERVER_REC *server)
|
|||
for (tmp = channel->banlist; tmp != NULL; tmp = tmp->next) {
|
||||
BAN_REC *rec = tmp->data;
|
||||
|
||||
printformat(server, channel->name, MSGLEVEL_CRAP,
|
||||
printformat(server, channel->visible_name, MSGLEVEL_CRAP,
|
||||
(rec->setby == NULL || *rec->setby == '\0') ?
|
||||
IRCTXT_BANLIST : IRCTXT_BANLIST_LONG,
|
||||
counter, channel->name, rec->ban, rec->setby,
|
||||
counter, channel->visible_name,
|
||||
rec->ban, rec->setby,
|
||||
(int) (time(NULL)-rec->time));
|
||||
counter++;
|
||||
}
|
||||
|
|
@ -306,7 +311,8 @@ static void cmd_ver(gchar *data, IRC_SERVER_REC *server, WI_ITEM_REC *item)
|
|||
if (*data == '\0' && !IS_IRC_ITEM(item))
|
||||
cmd_return_error(CMDERR_NOT_JOINED);
|
||||
|
||||
str = g_strdup_printf("%s VERSION", *data == '\0' ? item->name : data);
|
||||
str = g_strdup_printf("%s VERSION", *data == '\0' ?
|
||||
window_item_get_target(item) : data);
|
||||
signal_emit("command ctcp", 3, str, server, item);
|
||||
g_free(str);
|
||||
}
|
||||
|
|
@ -321,9 +327,9 @@ static void cmd_topic(const char *data, SERVER_REC *server, WI_ITEM_REC *item)
|
|||
channel = *data != '\0' ? channel_find(server, data) : CHANNEL(item);
|
||||
if (channel == NULL) return;
|
||||
|
||||
printformat(server, channel->name, MSGLEVEL_CRAP,
|
||||
printformat(server, channel->visible_name, MSGLEVEL_CRAP,
|
||||
channel->topic == NULL ? IRCTXT_NO_TOPIC : IRCTXT_TOPIC,
|
||||
channel->name, channel->topic);
|
||||
channel->visible_name, channel->topic);
|
||||
|
||||
if (channel->topic_time > 0) {
|
||||
byhost = strchr(channel->topic_by, '!');
|
||||
|
|
@ -337,7 +343,7 @@ static void cmd_topic(const char *data, SERVER_REC *server, WI_ITEM_REC *item)
|
|||
}
|
||||
|
||||
timestr = my_asctime(channel->topic_time);
|
||||
printformat(server, channel->name, MSGLEVEL_CRAP,
|
||||
printformat(server, channel->visible_name, MSGLEVEL_CRAP,
|
||||
IRCTXT_TOPIC_INFO, bynick, timestr, byhost);
|
||||
g_free(timestr);
|
||||
g_free(bynick);
|
||||
|
|
@ -356,7 +362,8 @@ static void cmd_ts(const char *data)
|
|||
CHANNEL_REC *rec = tmp->data;
|
||||
|
||||
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, IRCTXT_TOPIC,
|
||||
rec->name, rec->topic == NULL ? "" : rec->topic);
|
||||
rec->visible_name,
|
||||
rec->topic == NULL ? "" : rec->topic);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -423,7 +430,7 @@ static void cmd_sethost(const char *data, IRC_SERVER_REC *server)
|
|||
CHANNEL_REC *channel = tmp->data;
|
||||
|
||||
window_bind_add(window_item_window(channel),
|
||||
server->tag, channel->name);
|
||||
server->tag, channel->visible_name);
|
||||
}
|
||||
|
||||
irc_send_cmdv(server, "SETHOST %s", data);
|
||||
|
|
|
|||
|
|
@ -1,63 +0,0 @@
|
|||
/*
|
||||
fe-irc-layout.c : irssi
|
||||
|
||||
Copyright (C) 2000-2002 Timo Sirainen
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "module.h"
|
||||
#include "signals.h"
|
||||
#include "settings.h"
|
||||
#include "lib-config/iconfig.h"
|
||||
|
||||
#include "irc-servers.h"
|
||||
#include "irc-channels.h"
|
||||
|
||||
#include "fe-windows.h"
|
||||
|
||||
static void sig_layout_save_item(WINDOW_REC *window, WI_ITEM_REC *item,
|
||||
CONFIG_NODE *node)
|
||||
{
|
||||
CONFIG_NODE *subnode;
|
||||
IRC_CHANNEL_REC *channel;
|
||||
char *name;
|
||||
|
||||
channel = IRC_CHANNEL(item);
|
||||
if (channel == NULL || *channel->name != '!')
|
||||
return;
|
||||
|
||||
/* save !ABCDEchannels using just short name */
|
||||
subnode = config_node_section(node, NULL, NODE_TYPE_BLOCK);
|
||||
|
||||
name = g_strconcat("!", channel->name+6, NULL);
|
||||
iconfig_node_set_str(subnode, "type", "CHANNEL");
|
||||
iconfig_node_set_str(subnode, "chat_type", "IRC");
|
||||
iconfig_node_set_str(subnode, "name", name);
|
||||
iconfig_node_set_str(subnode, "tag", channel->server->tag);
|
||||
g_free(name);
|
||||
|
||||
signal_stop();
|
||||
}
|
||||
|
||||
void fe_irc_layout_init(void)
|
||||
{
|
||||
signal_add("layout save item", (SIGNAL_FUNC) sig_layout_save_item);
|
||||
}
|
||||
|
||||
void fe_irc_layout_deinit(void)
|
||||
{
|
||||
signal_remove("layout save item", (SIGNAL_FUNC) sig_layout_save_item);
|
||||
}
|
||||
|
|
@ -29,12 +29,27 @@
|
|||
#include "levels.h"
|
||||
#include "irc-chatnets.h"
|
||||
#include "irc-servers.h"
|
||||
#include "irc-channels.h"
|
||||
#include "servers-reconnect.h"
|
||||
#include "irc-servers-setup.h"
|
||||
|
||||
#include "fe-windows.h"
|
||||
#include "printtext.h"
|
||||
|
||||
const char *get_visible_target(IRC_SERVER_REC *server, const char *target)
|
||||
{
|
||||
IRC_CHANNEL_REC *channel;
|
||||
|
||||
if (*target == '!') {
|
||||
/* visible_name of !channels is different - don't bother
|
||||
checking other types for now, they'll just slow up */
|
||||
channel = irc_channel_find(server, target);
|
||||
if (channel != NULL)
|
||||
return channel->visible_name;
|
||||
}
|
||||
|
||||
return target;
|
||||
}
|
||||
/* SYNTAX: SERVER ADD [-4 | -6] [-auto | -noauto] [-ircnet <ircnet>]
|
||||
[-host <hostname>] [-cmdspeed <ms>] [-cmdmax <count>]
|
||||
[-port <port>] <address> [<port> [<password>]] */
|
||||
|
|
|
|||
9
src/fe-common/irc/fe-irc-server.h
Normal file
9
src/fe-common/irc/fe-irc-server.h
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
#ifndef __FE_IRC_SERVER_H
|
||||
#define __FE_IRC_SERVER_H
|
||||
|
||||
const char *get_visible_target(IRC_SERVER_REC *server, const char *target);
|
||||
|
||||
void fe_irc_server_init(void);
|
||||
void fe_irc_server_deinit(void);
|
||||
|
||||
#endif
|
||||
|
|
@ -84,9 +84,9 @@ static void print_mode(MODE_REC *rec)
|
|||
tmp = modes; modes = NULL;
|
||||
|
||||
nicks = gslist_to_string(rec->nicks, ", ");
|
||||
printformat(rec->channel->server, rec->channel->name, MSGLEVEL_MODES,
|
||||
IRCTXT_CHANMODE_CHANGE,
|
||||
rec->channel->name, rec->mode, nicks, "");
|
||||
printformat(rec->channel->server, rec->channel->visible_name,
|
||||
MSGLEVEL_MODES, IRCTXT_CHANMODE_CHANGE,
|
||||
rec->channel->visible_name, rec->mode, nicks, "");
|
||||
g_free(nicks);
|
||||
|
||||
modes = tmp;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue