summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2002-05-12 15:18:10 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2002-05-12 15:18:10 +0000
commit15eaa7cc888880ed26a682a8cfa643e67a9636e7 (patch)
tree4ffa32022fc06e4234fa3f82888614e473e92641 /src
parent3ac451c608d247c0ef0063c1e00eb6aea8a9bb19 (diff)
downloadirssi-15eaa7cc888880ed26a682a8cfa643e67a9636e7.zip
Split nick and host for topic info format.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2782 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src')
-rw-r--r--src/fe-common/irc/fe-events-numeric.c12
-rw-r--r--src/fe-common/irc/fe-irc-commands.c15
-rw-r--r--src/fe-common/irc/module-formats.c2
3 files changed, 22 insertions, 7 deletions
diff --git a/src/fe-common/irc/fe-events-numeric.c b/src/fe-common/irc/fe-events-numeric.c
index e06b3acf..1ea6bd2b 100644
--- a/src/fe-common/irc/fe-events-numeric.c
+++ b/src/fe-common/irc/fe-events-numeric.c
@@ -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);
}
diff --git a/src/fe-common/irc/fe-irc-commands.c b/src/fe-common/irc/fe-irc-commands.c
index dafa3dde..4bbdb96a 100644
--- a/src/fe-common/irc/fe-irc-commands.c
+++ b/src/fe-common/irc/fe-irc-commands.c
@@ -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();
}
diff --git a/src/fe-common/irc/module-formats.c b/src/fe-common/irc/module-formats.c
index eb97acea..3e895709 100644
--- a/src/fe-common/irc/module-formats.c
+++ b/src/fe-common/irc/module-formats.c
@@ -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 } },