]> jfr.im git - irc/quakenet/snircd-patchqueue.git/blame - addnickchasetomodenick.patch
oplevelforward.patch - revert to earlier fix + comments
[irc/quakenet/snircd-patchqueue.git] / addnickchasetomodenick.patch
CommitLineData
715c825d
CP
1ircu uses nick chasing for whowas, but also for targetting /kill, /kick, /mode o/v, in case a nick isnt found, the whowas history is check and the intented victim is chased (time limit is 30 seconds)
2
3example without this patch:
400:01 > NICK newnick
500:01 > MODE oldnick +w
600:01 < oldnick!user@host NICK newnick
700:01 < irc.quakenet.org 403 newnick oldnick :no such channel
8usermode change failed because of the nick change getting in the way
9
10example with this patch:
1100:01 > NICK newnick
1200:01 > MODE oldnick +w
1300:01 < oldnick!user@host NICK newnick
1400:01 < newnick!user@host MODE newnick +w
15usermode change succeeded because ircd uses whowas history and found the previous user with this nick was this user
16much friendlier and simply achieved by using information already available
17
a87bc2c2 18diff -r 85f3d4ad0a52 include/channel.h
19--- a/include/channel.h Mon Jan 26 12:10:57 2009 +0100
20+++ b/include/channel.h Mon Jan 26 12:29:23 2009 +0100
715c825d
CP
21@@ -390,7 +390,7 @@
22 extern void make_zombie(struct Membership* member, struct Client* who,
23 struct Client* cptr, struct Client* sptr,
24 struct Channel* chptr);
25-extern struct Client* find_chasing(struct Client* sptr, const char* user, int* chasing);
26+extern struct Client* find_chasing(struct Client* sptr, const char* user, int* chasing, int error);
27 void add_invite(struct Client *cptr, struct Channel *chptr);
28 int number_of_zombies(struct Channel *chptr);
29
a87bc2c2 30diff -r 85f3d4ad0a52 ircd/channel.c
31--- a/ircd/channel.c Mon Jan 26 12:10:57 2009 +0100
32+++ b/ircd/channel.c Mon Jan 26 12:29:23 2009 +0100
715c825d
CP
33@@ -218,9 +218,10 @@
34 * @param user a string representing the client to be found
35 * @param chasing a variable set to 0 if the user was found directly,
36 * 1 otherwise
37+ * @param error send error to source when set to 1, else not
38 * @returns a pointer the client, or NULL if the client wasn't found.
39 */
40-struct Client* find_chasing(struct Client* sptr, const char* user, int* chasing)
41+struct Client* find_chasing(struct Client* sptr, const char* user, int* chasing, int error)
42 {
43 struct Client* who = FindClient(user);
44
45@@ -230,7 +231,8 @@
46 return who;
47
48 if (!(who = get_history(user, feature_int(FEAT_KILLCHASETIMELIMIT)))) {
49- send_reply(sptr, ERR_NOSUCHNICK, user);
50+ if (error)
51+ send_reply(sptr, ERR_NOSUCHNICK, user);
52 return 0;
53 }
54 if (chasing)
55@@ -3120,7 +3122,7 @@
56 oplevel = req_oplevel;
57 }
58 /* find client we're manipulating */
59- acptr = find_chasing(state->sptr, t_str, NULL);
a87bc2c2 60+ acptr = find_chasing(state->sptr, t_str, NULL, 1);
715c825d
CP
61 } else {
62 if (t_str[5] == ':') {
63 t_str[5] = '\0';
a87bc2c2 64diff -r 85f3d4ad0a52 ircd/m_kick.c
65--- a/ircd/m_kick.c Mon Jan 26 12:10:57 2009 +0100
66+++ b/ircd/m_kick.c Mon Jan 26 12:29:23 2009 +0100
715c825d
CP
67@@ -127,7 +127,7 @@
68 || !IsChanOp(member2))
69 return send_reply(sptr, ERR_CHANOPRIVSNEEDED, name);
70
71- if (!(who = find_chasing(sptr, parv[2], 0)))
a87bc2c2 72+ if (!(who = find_chasing(sptr, parv[2], 0, 1)))
715c825d
CP
73 return 0; /* find_chasing sends the reply for us */
74
75 /* Don't allow the channel service to be kicked */
a87bc2c2 76diff -r 85f3d4ad0a52 ircd/m_mode.c
77--- a/ircd/m_mode.c Mon Jan 26 12:10:57 2009 +0100
78+++ b/ircd/m_mode.c Mon Jan 26 12:29:23 2009 +0100
715c825d
CP
79@@ -117,7 +117,7 @@
80 struct Client *acptr;
81
82 acptr = FindUser(parv[1]);
83- if (!acptr)
a87bc2c2 84+ if (!(acptr = find_chasing(sptr, parv[1], 0, 0)))
715c825d
CP
85 {
86 send_reply(sptr, ERR_NOSUCHCHANNEL, parv[1]);
87 return 0;