]> jfr.im git - irc/quakenet/snircd-patchqueue.git/blob - addnickchasetomodenick.patch
add operglinenick.patch - allow oper to set glines in form of nick@* gline, but only...
[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 ec3841c774be include/channel.h
19 --- a/include/channel.h Sun Jan 11 22:38:38 2009 +0000
20 +++ b/include/channel.h Sun Jan 11 22:38:38 2009 +0000
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 ec3841c774be ircd/channel.c
31 --- a/ircd/channel.c Sun Jan 11 22:38:38 2009 +0000
32 +++ b/ircd/channel.c Sun Jan 11 22:38:38 2009 +0000
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 ec3841c774be ircd/m_kick.c
65 --- a/ircd/m_kick.c Sun Jan 11 22:38:38 2009 +0000
66 +++ b/ircd/m_kick.c Sun Jan 11 22:38:38 2009 +0000
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 ec3841c774be ircd/m_mode.c
77 --- a/ircd/m_mode.c Sun Jan 11 22:38:38 2009 +0000
78 +++ b/ircd/m_mode.c Sun Jan 11 22:38:38 2009 +0000
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;