From: Entrope Date: Wed, 18 Feb 2004 00:18:30 +0000 (+0000) Subject: Support topic bursts; fix topic display in CHANINFO command X-Git-Tag: v1.4.0-rc1~274 X-Git-Url: http://git.pk910.de/?p=srvx.git;a=commitdiff_plain;h=e6b05f584a0c66415bb6fc28a93c00e0dd24d50f Support topic bursts; fix topic display in CHANINFO command When we wipe out an older channel on our end, clear its topic. Fix the message send function used by CHANINFO. When we get a P10 T message, check for the extra fields added in Asuka. git-archimport-id: srvx@srvx.net--2004-srvx/srvx--devo--1.3--patch-2 --- diff --git a/src/hash.c b/src/hash.c index 8952ac0..b63da6d 100644 --- a/src/hash.c +++ b/src/hash.c @@ -281,6 +281,11 @@ wipeout_channel(struct chanNode *cNode, time_t new_time, char **modes, unsigned char orig_key[KEYLEN+1]; unsigned int nn, argc; + /* nuke old topic */ + cNode->topic[0] = '\0'; + cNode->topic_nick[0] = '\0'; + cNode->topic_time = 0; + /* remember the old modes, and update them with the new */ orig_modes = cNode->modes; orig_limit = cNode->limit; diff --git a/src/opserv.c b/src/opserv.c index 2062c5e..3da6e3e 100644 --- a/src/opserv.c +++ b/src/opserv.c @@ -437,7 +437,7 @@ static MODCMD_FUNC(cmd_chaninfo) if (channel->topic_time) { fmt = user_find_message(user, "OSMSG_CHANINFO_TOPIC"); strftime(buffer, sizeof(buffer), fmt, gmtime(&channel->topic_time)); - reply(buffer, channel->topic_nick, channel->topic); + send_message_type(4, user, cmd->parent->bot, buffer, channel->topic_nick, channel->topic); } else { irc_fetchtopic(cmd->parent->bot, channel->name); reply("OSMSG_CHANINFO_TOPIC_UNKNOWN"); diff --git a/src/proto-p10.c b/src/proto-p10.c index b711c10..5aabfc5 100644 --- a/src/proto-p10.c +++ b/src/proto-p10.c @@ -1124,7 +1124,8 @@ static CMD_FUNC(cmd_clearmode) static CMD_FUNC(cmd_topic) { - static struct chanNode *cn; + struct chanNode *cn; + time_t chan_ts, topic_ts; if (argc < 3) return 0; @@ -1132,7 +1133,16 @@ static CMD_FUNC(cmd_topic) log_module(MAIN_LOG, LOG_ERROR, "Unable to find channel %s whose topic is being set", argv[1]); return 0; } - SetChannelTopic(cn, GetUserH(origin), argv[2], 0); + if (argc >= 5) { + /* Looks like an Asuka style topic burst. */ + chan_ts = atoi(argv[2]); + topic_ts = atoi(argv[3]); + } else { + chan_ts = cn->timestamp; + topic_ts = now; + } + SetChannelTopic(cn, GetUserH(origin), argv[argc-1], 0); + cn->topic_time = topic_ts; return 1; }