… | |
… | |
8 | * Portions of this file were derived from sources bearing the following license: |
8 | * Portions of this file were derived from sources bearing the following license: |
9 | * Rights to this code are documented in doc/pod/license.pod. |
9 | * Rights to this code are documented in doc/pod/license.pod. |
10 | * Copyright © 2005-2007 Atheme Project (http://www.atheme.org) |
10 | * Copyright © 2005-2007 Atheme Project (http://www.atheme.org) |
11 | */ |
11 | */ |
12 | |
12 | |
13 | static char const rcsid[] = "$Id: ptasks.C,v 1.10 2007/09/16 18:54:45 pippijn Exp $"; |
13 | static char const rcsid[] = "$Id: ptasks.C,v 1.11 2007/09/22 14:27:30 pippijn Exp $"; |
|
|
14 | |
|
|
15 | #include <boost/foreach.hpp> |
14 | |
16 | |
15 | #include "atheme.h" |
17 | #include "atheme.h" |
|
|
18 | #include <libermyth.h> |
|
|
19 | #include <ermyth/system.h> |
|
|
20 | #include <util/time.h> |
16 | #include "servers.h" |
21 | #include "servers.h" |
17 | #include <account/myuser.h> |
22 | #include <account/myuser.h> |
18 | #include <account/mynick.h> |
23 | #include <account/mynick.h> |
19 | #include <account/kline.h> |
24 | #include <account/kline.h> |
20 | #include <account/svsignore.h> |
25 | #include <account/svsignore.h> |
21 | #include <common/random.h> |
26 | #include <util/random.h> |
22 | #include "uplink.h" |
27 | #include "uplink.h" |
23 | #include "pmodule.h" |
28 | #include "pmodule.h" |
24 | #include "privs.h" |
29 | #include "privs.h" |
25 | #include "connection.h" |
30 | #include "connection.h" |
26 | |
31 | |
… | |
… | |
75 | |
80 | |
76 | void |
81 | void |
77 | handle_stats (user_t *u, char req) |
82 | handle_stats (user_t *u, char req) |
78 | { |
83 | { |
79 | kline_t *k; |
84 | kline_t *k; |
80 | node_t *n; |
|
|
81 | kline_t::list_type::iterator klit = kline_t::list.begin (); |
85 | kline_t::list_type::iterator klit = kline_t::list.begin (); |
82 | kline_t::list_type::iterator klet = kline_t::list.end (); |
86 | kline_t::list_type::iterator klet = kline_t::list.end (); |
83 | uplink_t *uplink; |
|
|
84 | soper_t *soper; |
|
|
85 | int i, j; |
87 | int i, j; |
86 | char fl[10]; |
88 | char fl[10]; |
87 | |
89 | |
88 | if (floodcheck (u, NULL)) |
90 | if (floodcheck (u, NULL)) |
89 | return; |
91 | return; |
… | |
… | |
103 | case 'C': |
105 | case 'C': |
104 | case 'c': |
106 | case 'c': |
105 | if (!has_priv_user (u, PRIV_SERVER_AUSPEX)) |
107 | if (!has_priv_user (u, PRIV_SERVER_AUSPEX)) |
106 | break; |
108 | break; |
107 | |
109 | |
108 | LIST_FOREACH (n, uplinks.head) |
110 | foreach (uplink_t *ul, uplinks) |
109 | { |
|
|
110 | uplink = (uplink_t *) n->data; |
|
|
111 | phandler->numeric_sts (me.name, 213, u->nick, "C *@127.0.0.1 A %s %d uplink", uplink->name, uplink->port); |
111 | phandler->numeric_sts (me.name, 213, u->nick, "C *@127.0.0.1 A %s %d uplink", ul->name, ul->port); |
112 | } |
|
|
113 | break; |
112 | break; |
114 | |
113 | |
115 | case 'E': |
114 | case 'E': |
116 | case 'e': |
115 | case 'e': |
117 | if (!has_priv_user (u, PRIV_SERVER_AUSPEX)) |
116 | if (!has_priv_user (u, PRIV_SERVER_AUSPEX)) |
… | |
… | |
139 | case 'H': |
138 | case 'H': |
140 | case 'h': |
139 | case 'h': |
141 | if (!has_priv_user (u, PRIV_SERVER_AUSPEX)) |
140 | if (!has_priv_user (u, PRIV_SERVER_AUSPEX)) |
142 | break; |
141 | break; |
143 | |
142 | |
144 | LIST_FOREACH (n, uplinks.head) |
143 | foreach (uplink_t *ul, uplinks) |
145 | { |
|
|
146 | uplink = (uplink_t *) n->data; |
|
|
147 | phandler->numeric_sts (me.name, 244, u->nick, "H * * %s", uplink->name); |
144 | phandler->numeric_sts (me.name, 244, u->nick, "H * * %s", ul->name); |
148 | } |
|
|
149 | break; |
145 | break; |
150 | |
146 | |
151 | case 'I': |
147 | case 'I': |
152 | case 'i': |
148 | case 'i': |
153 | phandler->numeric_sts (me.name, 215, u->nick, "I * * *@%s 0 nonopered", me.name); |
149 | phandler->numeric_sts (me.name, 215, u->nick, "I * * *@%s 0 nonopered", me.name); |
… | |
… | |
171 | case 'o': |
167 | case 'o': |
172 | case 'O': |
168 | case 'O': |
173 | if (!has_priv_user (u, PRIV_VIEWPRIVS)) |
169 | if (!has_priv_user (u, PRIV_VIEWPRIVS)) |
174 | break; |
170 | break; |
175 | |
171 | |
176 | LIST_FOREACH (n, soperlist.head) |
172 | foreach (soper_t *soper, soper_t::list) |
177 | { |
173 | { |
178 | soper = static_cast<soper_t *> (n->data); |
174 | j = 0; |
179 | |
|
|
180 | j = 0; |
|
|
181 | if (!(soper->flags & SOPER_CONF)) |
175 | if (!(soper->flags & SOPER_CONF)) |
182 | fl[j++] = 'D'; |
176 | fl[j++] = 'D'; |
183 | if (soper->operclass != NULL && soper->operclass->flags & OPERCLASS_NEEDOPER) |
177 | if (soper->operclass != NULL && soper->operclass->flags & OPERCLASS_NEEDOPER) |
184 | fl[j++] = 'O'; |
178 | fl[j++] = 'O'; |
185 | if (j == 0) |
179 | if (j == 0) |
186 | fl[j++] = '*'; |
180 | fl[j++] = '*'; |
187 | fl[j] = '\0'; |
181 | fl[j] = '\0'; |
188 | phandler->numeric_sts (me.name, 243, u->nick, "O *@* %s %s %s %s", fl, soper->myuser ? soper->myuser->name : soper->name, soper->operclass ? soper->operclass->name : soper->classname, "-1"); |
182 | phandler->numeric_sts (me.name, 243, u->nick, "O *@* %s %s %s %s", fl, soper->myuser ? soper->myuser->name : soper->name, soper->operclass ? soper->operclass->name : soper->classname, "-1"); |
|
|
183 | } |
|
|
184 | break; |
189 | } |
185 | |
190 | break; |
|
|
191 | |
|
|
192 | case 'T': |
186 | case 'T': |
193 | case 't': |
187 | case 't': |
194 | if (!has_priv_user (u, PRIV_SERVER_AUSPEX)) |
188 | if (!has_priv_user (u, PRIV_SERVER_AUSPEX)) |
195 | break; |
189 | break; |
196 | |
190 | |