2
2
* ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
4
4
* Copyright (c) 1997 Jukka Santala (Donwulff)
5
* Copyright (c) 2000-2014 ircd-hybrid development team
5
* Copyright (c) 2000-2015 ircd-hybrid development team
7
7
* This program is free software; you can redistribute it and/or modify
8
8
* it under the terms of the GNU General Public License as published by
102
if (dlink_list_length(&source_p->localClient->watches) >=
102
if (dlink_list_length(&source_p->connection->watches) >=
103
103
ConfigGeneral.max_watch)
105
105
sendto_one_numeric(source_p, &me, ERR_TOOMANYWATCH, s + 1, ConfigGeneral.max_watch);
143
143
if (*s == 'S' || *s == 's')
145
145
char buf[IRCD_BUFSIZE] = "";
146
const struct Watch *anptr = NULL;
146
const struct Watch *watch = NULL;
147
147
unsigned int count = 0;
149
149
if (list_requested & 0x1)
155
155
* Send a list of how many users they have on their WATCH list
156
156
* and how many WATCH lists they are on.
158
if ((anptr = watch_find_hash(source_p->name)))
159
count = dlink_list_length(&anptr->watched_by);
158
if ((watch = watch_find_hash(source_p->name)))
159
count = dlink_list_length(&watch->watched_by);
161
161
sendto_one_numeric(source_p, &me, RPL_WATCHSTAT,
162
dlink_list_length(&source_p->localClient->watches), count);
162
dlink_list_length(&source_p->connection->watches), count);
165
165
* Send a list of everybody in their WATCH list. Be careful
166
166
* not to buffer overflow.
168
if ((ptr = source_p->localClient->watches.head) == NULL)
168
if ((node = source_p->connection->watches.head) == NULL)
170
170
sendto_one_numeric(source_p, &me, RPL_ENDOFWATCHLIST, *s);
175
strlcpy(buf, anptr->nick, sizeof(buf));
175
strlcpy(buf, watch->nick, sizeof(buf));
177
177
count = strlen(source_p->name) + strlen(me.name) + 10 +
180
while ((ptr = ptr->next))
180
while ((node = node->next))
184
if (count + strlen(anptr->nick) + 1 > IRCD_BUFSIZE - 2)
184
if (count + strlen(watch->nick) + 1 > IRCD_BUFSIZE - 2)
186
186
sendto_one_numeric(source_p, &me, RPL_WATCHLIST, buf);
191
191
strlcat(buf, " ", sizeof(buf));
192
strlcat(buf, anptr->nick, sizeof(buf));
193
count += (strlen(anptr->nick) + 1);
192
strlcat(buf, watch->nick, sizeof(buf));
193
count += (strlen(watch->nick) + 1);
196
196
sendto_one_numeric(source_p, &me, RPL_WATCHLIST, buf);
213
213
list_requested |= 0x2;
215
DLINK_FOREACH(ptr, source_p->localClient->watches.head)
215
DLINK_FOREACH(node, source_p->connection->watches.head)
217
const struct Watch *anptr = ptr->data;
217
const struct Watch *watch = node->data;
219
if ((target_p = find_person(source_p, anptr->nick)))
219
if ((target_p = find_person(source_p, watch->nick)))
220
220
sendto_one_numeric(source_p, &me, RPL_NOWON,
221
221
target_p->name, target_p->username,
222
222
target_p->host, target_p->tsinfo);
226
226
* 'L' (full list wanted).
228
228
else if (*s == 'L')
229
sendto_one_numeric(source_p, &me, RPL_NOWOFF, anptr->nick,
230
"*", "*", anptr->lasttime);
229
sendto_one_numeric(source_p, &me, RPL_NOWOFF, watch->nick,
230
"*", "*", watch->lasttime);
233
233
sendto_one_numeric(source_p, &me, RPL_ENDOFWATCHLIST, *s);
265
265
.node = { NULL, NULL, NULL },
267
.version = "$Revision: 4564 $",
267
.version = "$Revision: 5346 $",
269
269
.modinit = module_init,
270
270
.modexit = module_exit,