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
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;
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");
static CMD_FUNC(cmd_topic)
{
- static struct chanNode *cn;
+ struct chanNode *cn;
+ time_t chan_ts, topic_ts;
if (argc < 3)
return 0;
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;
}