Support topic bursts; fix topic display in CHANINFO command
authorEntrope <entrope@clan-dk.org>
Wed, 18 Feb 2004 00:18:30 +0000 (00:18 +0000)
committerEntrope <entrope@clan-dk.org>
Wed, 18 Feb 2004 00:18:30 +0000 (00:18 +0000)
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

src/hash.c
src/opserv.c
src/proto-p10.c

index 8952ac0595d368ebeeca96ae388c29abd1033d6e..b63da6d7458a916c3260df09cd01abc506ee265b 100644 (file)
@@ -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;
index 2062c5e786f5a7daab727ca1427dfbabef1261c0..3da6e3e086d04af349ba076413eb850413d7c2d6 100644 (file)
@@ -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");
index b711c101f709b5e63ef5537296dcd57c04f522b6..5aabfc5b865f2bffeeba735ab0178547be7dec77 100644 (file)
@@ -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;
 }