]> jfr.im git - irc/quakenet/snircd-patchqueue.git/blob - addnickchasetomodenick.patch
glinesnomask.patch - updated for ircu merge plus a few minor fixes
[irc/quakenet/snircd-patchqueue.git] / addnickchasetomodenick.patch
1 ircu 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
3 example without this patch:
4 00:01 > NICK newnick
5 00:01 > MODE oldnick +w
6 00:01 < oldnick!user@host NICK newnick
7 00:01 < irc.quakenet.org 403 newnick oldnick :no such channel
8 usermode change failed because of the nick change getting in the way
9
10 example with this patch:
11 00:01 > NICK newnick
12 00:01 > MODE oldnick +w
13 00:01 < oldnick!user@host NICK newnick
14 00:01 < newnick!user@host MODE newnick +w
15 usermode change succeeded because ircd uses whowas history and found the previous user with this nick was this user
16 much friendlier and simply achieved by using information already available
17
18 diff -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
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
30 diff -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
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);
60 + acptr = find_chasing(state->sptr, t_str, NULL, 1);
61 } else {
62 if (t_str[5] == ':') {
63 t_str[5] = '\0';
64 diff -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
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)))
72 + if (!(who = find_chasing(sptr, parv[2], 0, 1)))
73 return 0; /* find_chasing sends the reply for us */
74
75 /* Don't allow the channel service to be kicked */
76 diff -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
79 @@ -117,7 +117,7 @@
80 struct Client *acptr;
81
82 acptr = FindUser(parv[1]);
83 - if (!acptr)
84 + if (!(acptr = find_chasing(sptr, parv[1], 0, 0)))
85 {
86 send_reply(sptr, ERR_NOSUCHCHANNEL, parv[1]);
87 return 0;