1
0
mirror of https://github.com/irssi/irssi.git synced 2024-10-27 05:20:20 -04:00

Split nick and host for topic info format.

git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2782 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2002-05-12 15:18:10 +00:00 committed by cras
parent 3ac451c608
commit 15eaa7cc88
3 changed files with 22 additions and 7 deletions

View File

@ -222,17 +222,21 @@ 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, *topicby, *topictime;
char *params, *timestr, *channel, *bynick, *byhost, *topictime;
g_return_if_fail(data != NULL);
params = event_get_params(data, 4, NULL, &channel,
&topicby, &topictime);
&bynick, &topictime);
timestr = my_asctime((time_t) atol(topictime));
printformat(server, channel, MSGLEVEL_CRAP,
IRCTXT_TOPIC_INFO, topicby, timestr);
byhost = strchr(bynick, '!');
if (byhost != NULL)
*byhost++ = '\0';
printformat(server, channel, MSGLEVEL_CRAP, IRCTXT_TOPIC_INFO,
bynick, timestr, byhost == NULL ? "" : byhost);
g_free(timestr);
g_free(params);
}

View File

@ -314,7 +314,7 @@ static void cmd_ver(gchar *data, IRC_SERVER_REC *server, WI_ITEM_REC *item)
static void cmd_topic(const char *data, SERVER_REC *server, WI_ITEM_REC *item)
{
CHANNEL_REC *channel;
char *timestr;
char *timestr, *bynick, *byhost;
g_return_if_fail(data != NULL);
@ -326,10 +326,21 @@ static void cmd_topic(const char *data, SERVER_REC *server, WI_ITEM_REC *item)
channel->name, channel->topic);
if (channel->topic_time > 0) {
byhost = strchr(channel->topic_by, '!');
if (byhost == NULL) {
bynick = g_strdup(channel->topic_by);
byhost = "";
} else {
bynick = g_strndup(channel->topic_by,
(int) (byhost-channel->topic_by));
byhost++;
}
timestr = my_asctime(channel->topic_time);
printformat(server, channel->name, MSGLEVEL_CRAP,
IRCTXT_TOPIC_INFO, channel->topic_by, timestr);
IRCTXT_TOPIC_INFO, bynick, timestr, byhost);
g_free(timestr);
g_free(bynick);
}
signal_stop();
}

View File

@ -62,7 +62,7 @@ FORMAT_REC fecommon_irc_formats[] = {
{ "url", "Home page for {channelhilight $0}: $1", 2, { 0, 0 } },
{ "topic", "Topic for {channelhilight $0}: $1", 2, { 0, 0 } },
{ "no_topic", "No topic set for {channelhilight $0}", 1, { 0 } },
{ "topic_info", "Topic set by {nick $0} {comment $1}", 2, { 0, 0 } },
{ "topic_info", "Topic set by {nick $0} {nickhost $2} {comment $1}", 3, { 0, 0, 0 } },
{ "chanmode_change", "mode/{channelhilight $0} {mode $1} by {nick $2}", 4, { 0, 0, 0, 0 } },
{ "server_chanmode_change", "{netsplit ServerMode}/{channelhilight $0} {mode $1} by {nick $2}", 3, { 0, 0, 0 } },
{ "channel_mode", "mode/{channelhilight $0} {mode $1}", 2, { 0, 0 } },