~ubuntu-branches/debian/sid/ircd-hybrid/sid

« back to all changes in this revision

Viewing changes to modules/m_watch.c

  • Committer: Package Import Robot
  • Author(s): Dominic Hargreaves
  • Date: 2015-04-19 15:53:09 UTC
  • mfrom: (1.2.13)
  • Revision ID: package-import@ubuntu.com-20150419155309-06y59x2at2ax5ou3
Tags: 1:8.2.7+dfsg.1-1
* Remove Suggests: hybserv since it doesn't really work with
  ircd-hybrid 8 and above
* New upstream release
  - update debian/copyright with minor changes
  - update config files from new reference.conf
  - fixes DoS from localhost clients (Closes: #782859)
  - supports SSL certficate chaining (Closes: #769741)
* Debconf configuration script no longer ignores the result of
  upgrade questions (Closes: #779082)
* Don't display upgrade warnings on new installs (Closes: #782883)
* Add NEWS item about updated configuration

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 *  ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3
3
 *
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
6
6
 *
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
22
22
 
23
23
/*! \file m_watch.c
24
24
 * \brief Includes required functions for processing the WATCH command.
25
 
 * \version $Id: m_watch.c 4564 2014-08-24 10:24:47Z michael $
 
25
 * \version $Id: m_watch.c 5346 2015-01-11 12:41:14Z michael $
26
26
 */
27
27
 
28
28
#include "stdinc.h"
72
72
static int
73
73
m_watch(struct Client *source_p, int parc, char *parv[])
74
74
{
75
 
  dlink_node *ptr = NULL;
 
75
  dlink_node *node = NULL;
76
76
  char *s = NULL;
77
77
  char *p = NULL;
78
78
  char *user;
99
99
    {
100
100
      if (*(s + 1))
101
101
      {
102
 
        if (dlink_list_length(&source_p->localClient->watches) >=
 
102
        if (dlink_list_length(&source_p->connection->watches) >=
103
103
            ConfigGeneral.max_watch)
104
104
        {
105
105
          sendto_one_numeric(source_p, &me, ERR_TOOMANYWATCH, s + 1, ConfigGeneral.max_watch);
143
143
    if (*s == 'S' || *s == 's')
144
144
    {
145
145
      char buf[IRCD_BUFSIZE] = "";
146
 
      const struct Watch *anptr = NULL;
 
146
      const struct Watch *watch = NULL;
147
147
      unsigned int count = 0;
148
148
 
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.
157
157
       */
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);
160
160
 
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);
163
163
 
164
164
      /*
165
165
       * Send a list of everybody in their WATCH list. Be careful
166
166
       * not to buffer overflow.
167
167
       */
168
 
      if ((ptr = source_p->localClient->watches.head) == NULL)
 
168
      if ((node = source_p->connection->watches.head) == NULL)
169
169
      {
170
170
        sendto_one_numeric(source_p, &me, RPL_ENDOFWATCHLIST, *s);
171
171
        continue;
172
172
      }
173
173
 
174
 
      anptr = ptr->data;
175
 
      strlcpy(buf, anptr->nick, sizeof(buf));
 
174
      watch = node->data;
 
175
      strlcpy(buf, watch->nick, sizeof(buf));
176
176
 
177
177
      count = strlen(source_p->name) + strlen(me.name) + 10 +
178
178
              strlen(buf);
179
179
 
180
 
      while ((ptr = ptr->next))
 
180
      while ((node = node->next))
181
181
      {
182
 
        anptr = ptr->data;
 
182
        watch = node->data;
183
183
 
184
 
        if (count + strlen(anptr->nick) + 1 > IRCD_BUFSIZE - 2)
 
184
        if (count + strlen(watch->nick) + 1 > IRCD_BUFSIZE - 2)
185
185
        {
186
186
          sendto_one_numeric(source_p, &me, RPL_WATCHLIST, buf);
187
187
          buf[0] = '\0';
189
189
        }
190
190
 
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);
194
194
      }
195
195
 
196
196
      sendto_one_numeric(source_p, &me, RPL_WATCHLIST, buf);
212
212
 
213
213
      list_requested |= 0x2;
214
214
 
215
 
      DLINK_FOREACH(ptr, source_p->localClient->watches.head)
 
215
      DLINK_FOREACH(node, source_p->connection->watches.head)
216
216
      {
217
 
        const struct Watch *anptr = ptr->data;
 
217
        const struct Watch *watch = node->data;
218
218
 
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).
227
227
         */
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);
231
231
      }
232
232
 
233
233
      sendto_one_numeric(source_p, &me, RPL_ENDOFWATCHLIST, *s);
264
264
{
265
265
  .node    = { NULL, NULL, NULL },
266
266
  .name    = NULL,
267
 
  .version = "$Revision: 4564 $",
 
267
  .version = "$Revision: 5346 $",
268
268
  .handle  = NULL,
269
269
  .modinit = module_init,
270
270
  .modexit = module_exit,