Author: Alex Badea <vampire@p16.pub.ro>
[ircu2.10.12-pk.git] / patches / diffs / topicburst.diff
diff --git a/patches/diffs/topicburst.diff b/patches/diffs/topicburst.diff
new file mode 100644 (file)
index 0000000..0e4a4f3
--- /dev/null
@@ -0,0 +1,181 @@
+Index: doc/example.conf
+===================================================================
+RCS file: /home/coder-com/cvs/ircu2.10/doc/example.conf,v
+retrieving revision 1.15.2.3
+diff -u -r1.15.2.3 example.conf
+--- doc/example.conf   2002/02/04 22:06:11     1.15.2.3
++++ doc/example.conf   2002/02/11 09:17:57
+@@ -455,6 +455,7 @@
+ # F:NICKNAMEHISTORYLENGTH:800
+ # F:HOST_HIDING:FALSE
+ # F:HIDDEN_HOST:users.undernet.org
++# F:TOPIC_BURST:FALSE
+ # F:KILLCHASETIMELIMIT:30
+ # F:MAXCHANNELSPERUSER:10
+ # F:AVBANLEN:40
+Index: doc/readme.features
+===================================================================
+RCS file: /home/coder-com/cvs/ircu2.10/doc/readme.features,v
+retrieving revision 1.2.2.3
+diff -u -r1.2.2.3 readme.features
+--- doc/readme.features        2002/02/04 22:06:11     1.2.2.3
++++ doc/readme.features        2002/02/11 09:18:35
+@@ -235,6 +235,13 @@
+ This selects the suffix for the hidden hostmask (see HOST_HIDING).
++TOPIC_BURST
++ * Type: boolean
++ * Default: FALSE
++
++This selects whether topics are *sent* to other servers durring a burst.
++Note that receiving topics from servers is always enabled.
++
+ KILLCHASETIMELIMIT
+  * Type: integer
+  * Default: 30
+Index: include/ircd_features.h
+===================================================================
+RCS file: /home/coder-com/cvs/ircu2.10/include/ircd_features.h,v
+retrieving revision 1.11.2.3
+diff -u -r1.11.2.3 ircd_features.h
+--- include/ircd_features.h    2002/02/04 22:06:11     1.11.2.3
++++ include/ircd_features.h    2002/02/11 09:18:35
+@@ -44,6 +44,7 @@
+   FEAT_NICKNAMEHISTORYLENGTH,
+   FEAT_HOST_HIDING,
+   FEAT_HIDDEN_HOST,
++  FEAT_TOPIC_BURST,
+   /* features that probably should not be touched */
+   FEAT_KILLCHASETIMELIMIT,
+Index: ircd/channel.c
+===================================================================
+RCS file: /home/coder-com/cvs/ircu2.10/ircd/channel.c,v
+retrieving revision 1.73.2.5
+diff -u -r1.73.2.5 channel.c
+--- ircd/channel.c     2002/02/03 20:31:46     1.73.2.5
++++ ircd/channel.c     2002/02/11 09:23:28
+@@ -844,6 +844,10 @@
+     msgq_clean(mb);
+   }                             /* Continue when there was something
+                                  that didn't fit (full==1) */
++
++  if (feature_bool(FEAT_TOPIC_BURST) && *chptr->topic)
++    sendcmdto_one(&me, CMD_TOPIC, cptr, "%H %Tu :%s", chptr,
++                chptr->topic_time, chptr->topic);
+ }
+ /*
+Index: ircd/ircd_features.c
+===================================================================
+RCS file: /home/coder-com/cvs/ircu2.10/ircd/ircd_features.c,v
+retrieving revision 1.15.2.3
+diff -u -r1.15.2.3 ircd_features.c
+--- ircd/ircd_features.c       2002/02/04 22:06:11     1.15.2.3
++++ ircd/ircd_features.c       2002/02/11 09:23:30
+@@ -251,6 +251,7 @@
+   F_I(NICKNAMEHISTORYLENGTH, 0, 800, whowas_realloc),
+   F_B(HOST_HIDING, 0, 0, 0),
+   F_S(HIDDEN_HOST, FEAT_CASE, "users.undernet.org", 0),
++  F_B(TOPIC_BURST, 0, 0, 0),
+   /* features that probably should not be touched */
+   F_I(KILLCHASETIMELIMIT, 0, 30, 0),
+Index: ircd/m_topic.c
+===================================================================
+RCS file: /home/coder-com/cvs/ircu2.10/ircd/m_topic.c,v
+retrieving revision 1.9.2.1
+diff -u -r1.9.2.1 m_topic.c
+--- ircd/m_topic.c     2002/02/03 20:31:46     1.9.2.1
++++ ircd/m_topic.c     2002/02/11 09:23:30
+@@ -86,6 +86,7 @@
+ #include "hash.h"
+ #include "ircd.h"
+ #include "ircd_reply.h"
++#include "ircd_policy.h"
+ #include "ircd_string.h"
+ #include "msg.h"
+ #include "numeric.h"
+@@ -93,17 +94,24 @@
+ #include "send.h"
+ #include <assert.h>
++#include <stdlib.h>
+ static void do_settopic(struct Client *sptr, struct Client *cptr, 
+-                      struct Channel *chptr,char *topic)
++                      struct Channel *chptr, char *topic, time_t ts)
+ {
+    int newtopic;
++   struct Client *from;
+    /* if +n and not @'d, return an error and ignore the topic */
+-   if ((chptr->mode.mode & MODE_TOPICLIMIT) != 0 && !is_chan_op(sptr, chptr)) 
++   if (!IsServer(sptr) && (chptr->mode.mode & MODE_TOPICLIMIT) != 0 && !is_chan_op(sptr, chptr)) 
+    {
+       send_reply(sptr, ERR_CHANOPRIVSNEEDED, chptr->chname);
+       return;
+    }
++#ifdef HEAD_IN_SAND_BANWHO    /* Server-set topics are similar to bans */
++   from = IsServer(sptr) ? &me : sptr;
++#else
++   from = sptr;
++#endif
+    /* Note if this is just a refresh of an old topic, and don't
+     * send it to all the clients to save bandwidth.  We still send
+     * it to other servers as they may have split and lost the topic.
+@@ -111,14 +119,14 @@
+    newtopic=ircd_strncmp(chptr->topic,topic,TOPICLEN)!=0;
+    /* setting a topic */
+    ircd_strncpy(chptr->topic, topic, TOPICLEN);
+-   ircd_strncpy(chptr->topic_nick, cli_name(sptr), NICKLEN);
+-   chptr->topic_time = CurrentTime;
++   ircd_strncpy(chptr->topic_nick, cli_name(from), NICKLEN);
++   chptr->topic_time = ts ? ts : CurrentTime;
+    /* Fixed in 2.10.11: Don't propergate local topics */
+    if (!IsLocalChannel(chptr->chname))
+-     sendcmdto_serv_butone(sptr, CMD_TOPIC, cptr, "%H :%s", chptr,
+-                         chptr->topic);
++     sendcmdto_serv_butone(sptr, CMD_TOPIC, cptr, "%H %Tu :%s", chptr,
++                         chptr->topic_time, chptr->topic);
+    if (newtopic)
+-      sendcmdto_channel_butserv_butone(sptr, CMD_TOPIC, chptr, NULL,
++      sendcmdto_channel_butserv_butone(from, CMD_TOPIC, chptr, NULL,
+                                              "%H :%s", chptr, chptr->topic);
+       /* if this is the same topic as before we send it to the person that
+        * set it (so they knew it went through ok), but don't bother sending
+@@ -180,7 +188,7 @@
+       }
+     }
+     else 
+-     do_settopic(sptr,cptr,chptr,topic);
++     do_settopic(sptr,cptr,chptr,topic,0);
+   }
+   return 0;
+ }
+@@ -190,12 +198,14 @@
+  *
+  * parv[0]        = sender prefix
+  * parv[1]        = channel
++ * parv[parc - 2] = timestamp (optional)
+  * parv[parc - 1] = topic
+  */
+ int ms_topic(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
+ {
+   struct Channel *chptr;
+   char *topic = 0, *name, *p = 0;
++  time_t ts = 0;
+   if (parc < 3)
+     return need_more_params(sptr, "TOPIC");
+@@ -226,7 +236,9 @@
+       continue;
+     }
+-    do_settopic(sptr,cptr,chptr,topic);
++    if (parc > 3 && (ts = atoi(parv[parc - 2])) && chptr->topic_time > ts)
++      continue;
++    do_settopic(sptr,cptr,chptr,topic,ts);
+   }
+   return 0;
+ }