Include part of Isomer's realname gline fixes that I left out of a
[ircu2.10.12-pk.git] / patches / diffs / topicburst.diff
1 Index: doc/example.conf
2 ===================================================================
3 RCS file: /home/coder-com/cvs/ircu2.10/doc/example.conf,v
4 retrieving revision 1.15.2.3
5 diff -u -r1.15.2.3 example.conf
6 --- doc/example.conf    2002/02/04 22:06:11     1.15.2.3
7 +++ doc/example.conf    2002/02/11 09:17:57
8 @@ -455,6 +455,7 @@
9  # F:NICKNAMEHISTORYLENGTH:800
10  # F:HOST_HIDING:FALSE
11  # F:HIDDEN_HOST:users.undernet.org
12 +# F:TOPIC_BURST:FALSE
13  # F:KILLCHASETIMELIMIT:30
14  # F:MAXCHANNELSPERUSER:10
15  # F:AVBANLEN:40
16 Index: doc/readme.features
17 ===================================================================
18 RCS file: /home/coder-com/cvs/ircu2.10/doc/readme.features,v
19 retrieving revision 1.2.2.3
20 diff -u -r1.2.2.3 readme.features
21 --- doc/readme.features 2002/02/04 22:06:11     1.2.2.3
22 +++ doc/readme.features 2002/02/11 09:18:35
23 @@ -235,6 +235,13 @@
24  
25  This selects the suffix for the hidden hostmask (see HOST_HIDING).
26  
27 +TOPIC_BURST
28 + * Type: boolean
29 + * Default: FALSE
30 +
31 +This selects whether topics are *sent* to other servers durring a burst.
32 +Note that receiving topics from servers is always enabled.
33 +
34  KILLCHASETIMELIMIT
35   * Type: integer
36   * Default: 30
37 Index: include/ircd_features.h
38 ===================================================================
39 RCS file: /home/coder-com/cvs/ircu2.10/include/ircd_features.h,v
40 retrieving revision 1.11.2.3
41 diff -u -r1.11.2.3 ircd_features.h
42 --- include/ircd_features.h     2002/02/04 22:06:11     1.11.2.3
43 +++ include/ircd_features.h     2002/02/11 09:18:35
44 @@ -44,6 +44,7 @@
45    FEAT_NICKNAMEHISTORYLENGTH,
46    FEAT_HOST_HIDING,
47    FEAT_HIDDEN_HOST,
48 +  FEAT_TOPIC_BURST,
49  
50    /* features that probably should not be touched */
51    FEAT_KILLCHASETIMELIMIT,
52 Index: ircd/channel.c
53 ===================================================================
54 RCS file: /home/coder-com/cvs/ircu2.10/ircd/channel.c,v
55 retrieving revision 1.73.2.5
56 diff -u -r1.73.2.5 channel.c
57 --- ircd/channel.c      2002/02/03 20:31:46     1.73.2.5
58 +++ ircd/channel.c      2002/02/11 09:23:28
59 @@ -844,6 +844,10 @@
60      msgq_clean(mb);
61    }                             /* Continue when there was something
62                                   that didn't fit (full==1) */
63 +
64 +  if (feature_bool(FEAT_TOPIC_BURST) && *chptr->topic)
65 +    sendcmdto_one(&me, CMD_TOPIC, cptr, "%H %Tu :%s", chptr,
66 +                 chptr->topic_time, chptr->topic);
67  }
68  
69  /*
70 Index: ircd/ircd_features.c
71 ===================================================================
72 RCS file: /home/coder-com/cvs/ircu2.10/ircd/ircd_features.c,v
73 retrieving revision 1.15.2.3
74 diff -u -r1.15.2.3 ircd_features.c
75 --- ircd/ircd_features.c        2002/02/04 22:06:11     1.15.2.3
76 +++ ircd/ircd_features.c        2002/02/11 09:23:30
77 @@ -251,6 +251,7 @@
78    F_I(NICKNAMEHISTORYLENGTH, 0, 800, whowas_realloc),
79    F_B(HOST_HIDING, 0, 0, 0),
80    F_S(HIDDEN_HOST, FEAT_CASE, "users.undernet.org", 0),
81 +  F_B(TOPIC_BURST, 0, 0, 0),
82  
83    /* features that probably should not be touched */
84    F_I(KILLCHASETIMELIMIT, 0, 30, 0),
85 Index: ircd/m_topic.c
86 ===================================================================
87 RCS file: /home/coder-com/cvs/ircu2.10/ircd/m_topic.c,v
88 retrieving revision 1.9.2.1
89 diff -u -r1.9.2.1 m_topic.c
90 --- ircd/m_topic.c      2002/02/03 20:31:46     1.9.2.1
91 +++ ircd/m_topic.c      2002/02/11 09:23:30
92 @@ -86,6 +86,7 @@
93  #include "hash.h"
94  #include "ircd.h"
95  #include "ircd_reply.h"
96 +#include "ircd_policy.h"
97  #include "ircd_string.h"
98  #include "msg.h"
99  #include "numeric.h"
100 @@ -93,17 +94,24 @@
101  #include "send.h"
102  
103  #include <assert.h>
104 +#include <stdlib.h>
105  
106  static void do_settopic(struct Client *sptr, struct Client *cptr, 
107 -                       struct Channel *chptr,char *topic)
108 +                       struct Channel *chptr, char *topic, time_t ts)
109  {
110     int newtopic;
111 +   struct Client *from;
112     /* if +n and not @'d, return an error and ignore the topic */
113 -   if ((chptr->mode.mode & MODE_TOPICLIMIT) != 0 && !is_chan_op(sptr, chptr)) 
114 +   if (!IsServer(sptr) && (chptr->mode.mode & MODE_TOPICLIMIT) != 0 && !is_chan_op(sptr, chptr)) 
115     {
116        send_reply(sptr, ERR_CHANOPRIVSNEEDED, chptr->chname);
117        return;
118     }
119 +#ifdef HEAD_IN_SAND_BANWHO     /* Server-set topics are similar to bans */
120 +   from = IsServer(sptr) ? &me : sptr;
121 +#else
122 +   from = sptr;
123 +#endif
124     /* Note if this is just a refresh of an old topic, and don't
125      * send it to all the clients to save bandwidth.  We still send
126      * it to other servers as they may have split and lost the topic.
127 @@ -111,14 +119,14 @@
128     newtopic=ircd_strncmp(chptr->topic,topic,TOPICLEN)!=0;
129     /* setting a topic */
130     ircd_strncpy(chptr->topic, topic, TOPICLEN);
131 -   ircd_strncpy(chptr->topic_nick, cli_name(sptr), NICKLEN);
132 -   chptr->topic_time = CurrentTime;
133 +   ircd_strncpy(chptr->topic_nick, cli_name(from), NICKLEN);
134 +   chptr->topic_time = ts ? ts : CurrentTime;
135     /* Fixed in 2.10.11: Don't propergate local topics */
136     if (!IsLocalChannel(chptr->chname))
137 -     sendcmdto_serv_butone(sptr, CMD_TOPIC, cptr, "%H :%s", chptr,
138 -                          chptr->topic);
139 +     sendcmdto_serv_butone(sptr, CMD_TOPIC, cptr, "%H %Tu :%s", chptr,
140 +                          chptr->topic_time, chptr->topic);
141     if (newtopic)
142 -      sendcmdto_channel_butserv_butone(sptr, CMD_TOPIC, chptr, NULL,
143 +      sendcmdto_channel_butserv_butone(from, CMD_TOPIC, chptr, NULL,
144                                        "%H :%s", chptr, chptr->topic);
145        /* if this is the same topic as before we send it to the person that
146         * set it (so they knew it went through ok), but don't bother sending
147 @@ -180,7 +188,7 @@
148        }
149      }
150      else 
151 -     do_settopic(sptr,cptr,chptr,topic);
152 +     do_settopic(sptr,cptr,chptr,topic,0);
153    }
154    return 0;
155  }
156 @@ -190,12 +198,14 @@
157   *
158   * parv[0]        = sender prefix
159   * parv[1]        = channel
160 + * parv[parc - 2] = timestamp (optional)
161   * parv[parc - 1] = topic
162   */
163  int ms_topic(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
164  {
165    struct Channel *chptr;
166    char *topic = 0, *name, *p = 0;
167 +  time_t ts = 0;
168  
169    if (parc < 3)
170      return need_more_params(sptr, "TOPIC");
171 @@ -226,7 +236,9 @@
172        continue;
173      }
174  
175 -    do_settopic(sptr,cptr,chptr,topic);
176 +    if (parc > 3 && (ts = atoi(parv[parc - 2])) && chptr->topic_time > ts)
177 +      continue;
178 +    do_settopic(sptr,cptr,chptr,topic,ts);
179    }
180    return 0;
181  }