]> jfr.im git - irc/quakenet/snircd-patchqueue.git/blob - burstwhotopic.patch
Remove topic_reveal.patch. This has been fixed in IRCU and ircu patch is correct...
[irc/quakenet/snircd-patchqueue.git] / burstwhotopic.patch
1 Include what account set the topic when we are bursting topics.
2
3 We could also burst it like "nick" or "*account" or something alike
4 to distingish between a nick and an account, but then, nicks do not
5 mean a lot here, accounts do.
6
7 Control this sending/parsing with a new feature TOPIC_BURST_ACCOUNT?
8
9 diff -r 5385c7388842 ircd/channel.c
10 --- a/ircd/channel.c Mon Aug 10 14:18:35 2009 +0100
11 +++ b/ircd/channel.c Mon Aug 10 14:18:41 2009 +0100
12 @@ -1129,8 +1129,11 @@
13 if (opped_members)
14 MyFree(opped_members);
15 if (feature_bool(FEAT_TOPIC_BURST) && (chptr->topic[0] != '\0'))
16 - sendcmdto_one(&me, CMD_TOPIC, cptr, "%H %Tu %Tu :%s", chptr,
17 - chptr->creationtime, chptr->topic_time, chptr->topic);
18 + sendcmdto_one(&me, CMD_TOPIC, cptr, "%H %Tu %Tu %s%s:%s", chptr,
19 + chptr->creationtime, chptr->topic_time,
20 + chptr->topic_who_is_account ? chptr->topic_who : "", /* who set the topic */
21 + chptr->topic_who_is_account ? " " : "",
22 + chptr->topic);
23 }
24
25 /** Canonify a mask.
26 diff -r 5385c7388842 ircd/m_topic.c
27 --- a/ircd/m_topic.c Mon Aug 10 14:18:35 2009 +0100
28 +++ b/ircd/m_topic.c Mon Aug 10 14:18:41 2009 +0100
29 @@ -49,7 +49,7 @@
30 * @param[in] ts Timestamp that topic was set (0 for current time).
31 */
32 static void do_settopic(struct Client *sptr, struct Client *cptr,
33 - struct Channel *chptr, char *topic, time_t ts)
34 + struct Channel *chptr, char *topic, time_t ts, const char *who)
35 {
36 struct Client *from;
37 int newtopic;
38 @@ -65,15 +65,19 @@
39 newtopic=ircd_strncmp(chptr->topic,topic,TOPICLEN)!=0;
40 /* setting a topic */
41 ircd_strncpy(chptr->topic, topic, TOPICLEN);
42 - ircd_strncpy(chptr->topic_who,
43 - IsAccount(from) ? cli_user(from)->account : cli_name(from),
44 - IsAccount(from) ? ACCOUNTLEN : NICKLEN);
45 - chptr->topic_who_is_account = IsAccount(from) ? 1 : 0;
46 + if (!who)
47 + ircd_strncpy(chptr->topic_who,
48 + IsAccount(from) ? cli_user(from)->account : cli_name(from),
49 + IsAccount(from) ? ACCOUNTLEN : NICKLEN);
50 + else
51 + ircd_strncpy(chptr->topic_who, who, ACCOUNTLEN);
52 + chptr->topic_who_is_account = IsAccount(from) || who ? 1 : 0;
53 chptr->topic_time = ts ? ts : TStime();
54 /* Fixed in 2.10.11: Don't propagate local topics */
55 if (!IsLocalChannel(chptr->chname))
56 - sendcmdto_serv_butone(sptr, CMD_TOPIC, cptr, "%H %Tu %Tu :%s", chptr,
57 - chptr->creationtime, chptr->topic_time, chptr->topic);
58 + sendcmdto_serv_butone(sptr, CMD_TOPIC, cptr, "%H %Tu %Tu %s%s:%s", chptr,
59 + chptr->creationtime, chptr->topic_time,
60 + who ? who : "", who ? " " : "", chptr->topic);
61 if (newtopic)
62 {
63 struct Membership *member;
64 @@ -153,7 +157,7 @@
65 else if (!client_can_send_to_channel(sptr, chptr, 1))
66 send_reply(sptr, ERR_CANNOTSENDTOCHAN, chptr->chname);
67 else
68 - do_settopic(sptr,cptr,chptr,topic,0);
69 + do_settopic(sptr, cptr, chptr, topic, 0, 0);
70 }
71 return 0;
72 }
73 @@ -177,6 +181,7 @@
74 struct Membership* member;
75 char *topic = 0, *name, *p = 0;
76 time_t ts = 0;
77 + const char *who = 0;
78
79 if (parc < 3)
80 return need_more_params(sptr, "TOPIC");
81 @@ -207,11 +212,15 @@
82 if (parc > 4 && (ts = atoi(parv[3])) && chptr->topic_time > ts)
83 continue;
84
85 + /* got info on who set the topic sent in burst */
86 + if (parc > 5)
87 + who = parv[4];
88 +
89 /* Reveal delayedjoin user */
90 if ((member = find_member_link(chptr, sptr)) && IsDelayedJoin(member))
91 RevealDelayedJoin(member);
92
93 - do_settopic(sptr,cptr,chptr,topic, ts);
94 + do_settopic(sptr, cptr, chptr, topic, ts, who);
95 }
96 return 0;
97 }