]> jfr.im git - irc/quakenet/newserv.git/commitdiff
When setting the topic, make sure that the new timestamp is always truly newer than...
authorsplidge <redacted>
Wed, 2 Apr 2008 12:04:20 +0000 (13:04 +0100)
committersplidge <redacted>
Wed, 2 Apr 2008 12:04:20 +0000 (13:04 +0100)
localuser/localuserchannel.c

index 6c224cb8ed55329113bb00c65dd43a7aa700868c..bacb55b44c2e761207c573416b7cb60e9015b050 100644 (file)
@@ -887,6 +887,7 @@ void localusermodechange(nick *np, channel *cp, char *modes) {
 void localsettopic(nick *np, channel *cp, char *topic) {
   unsigned long *lp;
   char source[10];
+  time_t now=getnettime();
 
   if (np==NULL || (lp=getnumerichandlefromchanhash(cp->users,np->numeric))==NULL) {
     /* User isn't on channel, hack mode */
@@ -907,7 +908,13 @@ void localsettopic(nick *np, channel *cp, char *topic) {
   }
 
   cp->topic=getsstring(topic,TOPICLEN);
-  cp->topictime=getnettime();
+
+  /* Guarantee that the topic timestamp is greater than the old one. */
+  if (cp->topictime >= now) {
+    cp->topictime++;
+  } else {
+    cp->topictime=getnettime();
+  }
   
   if (connected) {
     irc_send("%s T %s %u %u :%s",source,cp->index->name->content,cp->timestamp,cp->topictime,(cp->topic)?cp->topic->content:"");