/[svn]/ircd-hybrid/branches/8.2.x/modules/m_cap.c
ViewVC logotype

Diff of /ircd-hybrid/branches/8.2.x/modules/m_cap.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 5018 by michael, Tue Dec 9 17:53:37 2014 UTC revision 5019 by michael, Thu Dec 11 14:52:31 2014 UTC
# Line 141  find_cap(const char **caplist_p, int *ne Line 141  find_cap(const char **caplist_p, int *ne
141   * @param[in] subcmd Name of capability subcommand.   * @param[in] subcmd Name of capability subcommand.
142   */   */
143  static int  static int
144  send_caplist(struct Client *source_p, unsigned int set,  send_caplist(struct Client *source_p,
145               unsigned int rem, const char *subcmd)               const unsigned int *const set,
146                 const unsigned int *const rem, const char *subcmd)
147  {  {
148    char capbuf[IRCD_BUFSIZE] = "", pfx[16];    char capbuf[IRCD_BUFSIZE] = "", pfx[16];
149    char cmdbuf[IRCD_BUFSIZE] = "";    char cmdbuf[IRCD_BUFSIZE] = "";
# Line 162  send_caplist(struct Client *source_p, un Line 163  send_caplist(struct Client *source_p, un
163       * capability if (and only if) it is set in \a rem or \a set, or       * capability if (and only if) it is set in \a rem or \a set, or
164       * if both are null and the capability is hidden.       * if both are null and the capability is hidden.
165       */       */
166      if (!(rem && (rem & capab_list[i].cap)) &&      if (!(rem && (*rem & capab_list[i].cap)) &&
167          !(set && (set & capab_list[i].cap)) &&          !(set && (*set & capab_list[i].cap)) &&
168           (rem || set || (flags & CAPFL_HIDDEN)))           (rem || set || (flags & CAPFL_HIDDEN)))
169        continue;        continue;
170    
# Line 172  send_caplist(struct Client *source_p, un Line 173  send_caplist(struct Client *source_p, un
173    
174      if (loc)      if (loc)
175        pfx[pfx_len++] = ' ';        pfx[pfx_len++] = ' ';
176      if (rem && (rem & capab_list[i].cap))      if (rem && (*rem & capab_list[i].cap))
177        pfx[pfx_len++] = '-';        pfx[pfx_len++] = '-';
178      else      else
179      {      {
# Line 208  cap_ls(struct Client *source_p, const ch Line 209  cap_ls(struct Client *source_p, const ch
209    if (IsUnknown(source_p))  /* Registration hasn't completed; suspend it... */    if (IsUnknown(source_p))  /* Registration hasn't completed; suspend it... */
210      source_p->connection->registration |= REG_NEED_CAP;      source_p->connection->registration |= REG_NEED_CAP;
211    
212    return send_caplist(source_p, 0, 0, "LS");  /* Send list of capabilities */    return send_caplist(source_p, NULL, NULL, "LS");  /* Send list of capabilities */
213  }  }
214    
215  static int  static int
# Line 255  cap_req(struct Client *source_p, const c Line 256  cap_req(struct Client *source_p, const c
256    }    }
257    
258    /* Notify client of accepted changes and copy over results. */    /* Notify client of accepted changes and copy over results. */
259    send_caplist(source_p, set, rem, "ACK");    send_caplist(source_p, &set, &rem, "ACK");
260    
261    source_p->connection->cap_client = cs;    source_p->connection->cap_client = cs;
262    source_p->connection->cap_active = as;    source_p->connection->cap_active = as;
# Line 279  cap_ack(struct Client *source_p, const c Line 280  cap_ack(struct Client *source_p, const c
280    {    {
281      /* Walk through the capabilities list... */      /* Walk through the capabilities list... */
282      if (!(cap = find_cap(&cl, &neg)) ||  /* Look up capability... */      if (!(cap = find_cap(&cl, &neg)) ||  /* Look up capability... */
283          (neg ? (source_p->connection->cap_active & cap->cap) :          (neg ? (source_p->connection->cap_client & cap->cap) :
284                !(source_p->connection->cap_active & cap->cap)))  /* uh... */                !(source_p->connection->cap_client & cap->cap)))  /* uh... */
285        continue;        continue;
286    
287      if (neg)  /* Set or clear the active capability... */      if (neg)  /* Set or clear the active capability... */
# Line 303  cap_clear(struct Client *source_p, const Line 304  cap_clear(struct Client *source_p, const
304      cap = &capab_list[ii];      cap = &capab_list[ii];
305    
306      /* Only clear active non-sticky capabilities. */      /* Only clear active non-sticky capabilities. */
307      if (!(source_p->connection->cap_active & cap->cap) || (cap->flags & CAPFL_STICKY))      if (!(source_p->connection->cap_client & cap->cap) || (cap->flags & CAPFL_STICKY))
308        continue;        continue;
309    
310      cleared |= cap->cap;      cleared |= cap->cap;
# Line 313  cap_clear(struct Client *source_p, const Line 314  cap_clear(struct Client *source_p, const
314        source_p->connection->cap_active &= ~cap->cap;        source_p->connection->cap_active &= ~cap->cap;
315    }    }
316    
317    return send_caplist(source_p, 0, cleared, "ACK");    return send_caplist(source_p, NULL, &cleared, "ACK");
318  }  }
319    
320  static int  static int
# Line 339  static int Line 340  static int
340  cap_list(struct Client *source_p, const char *caplist)  cap_list(struct Client *source_p, const char *caplist)
341  {  {
342    /* Send the list of the client's capabilities */    /* Send the list of the client's capabilities */
343    return send_caplist(source_p, source_p->connection->cap_client, 0, "LIST");    return send_caplist(source_p, &source_p->connection->cap_client, NULL, "LIST");
344  }  }
345    
346  static struct subcmd  static struct subcmd

Legend:
Removed from v.5018  
changed lines
  Added in v.5019

svnadmin@ircd-hybrid.org
ViewVC Help
Powered by ViewVC 1.1.28