/[svn]/ircd-hybrid/trunk/src/channel_mode.c
ViewVC logotype

Diff of /ircd-hybrid/trunk/src/channel_mode.c

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

revision 3149 by michael, Fri Mar 14 12:38:27 2014 UTC revision 3150 by michael, Fri Mar 14 14:11:34 2014 UTC
# Line 421  clear_ban_cache_client(struct Client *cl Line 421  clear_ban_cache_client(struct Client *cl
421    
422  /* Mode functions handle mode changes for a particular mode... */  /* Mode functions handle mode changes for a particular mode... */
423  static void  static void
424  chm_nosuch(struct Client *client_p, struct Client *source_p,  chm_nosuch(struct Client *source_p,
425             struct Channel *chptr, int parc, int *parn,             struct Channel *chptr, int parc, int *parn,
426             char **parv, int *errors, int alev, int dir, char c, unsigned int d)             char **parv, int *errors, int alev, int dir, char c, unsigned int d)
427  {  {
# Line 433  chm_nosuch(struct Client *client_p, stru Line 433  chm_nosuch(struct Client *client_p, stru
433  }  }
434    
435  static void  static void
436  chm_simple(struct Client *client_p, struct Client *source_p, struct Channel *chptr,  chm_simple(struct Client *source_p, struct Channel *chptr,
437             int parc, int *parn, char **parv, int *errors, int alev, int dir,             int parc, int *parn, char **parv, int *errors, int alev, int dir,
438             char c, unsigned int d)             char c, unsigned int d)
439  {  {
# Line 487  chm_simple(struct Client *client_p, stru Line 487  chm_simple(struct Client *client_p, stru
487  }  }
488    
489  static void  static void
490  chm_registered(struct Client *client_p, struct Client *source_p, struct Channel *chptr,  chm_registered(struct Client *source_p, struct Channel *chptr,
491             int parc, int *parn, char **parv, int *errors, int alev, int dir,                 int parc, int *parn, char **parv, int *errors, int alev, int dir,
492             char c, unsigned int d)                 char c, unsigned int d)
493  {  {
494    if (!IsServer(source_p) && !HasFlag(source_p, FLAGS_SERVICE))    if (!IsServer(source_p) && !HasFlag(source_p, FLAGS_SERVICE))
495    {    {
# Line 540  chm_registered(struct Client *client_p, Line 540  chm_registered(struct Client *client_p,
540  }  }
541    
542  static void  static void
543  chm_operonly(struct Client *client_p, struct Client *source_p, struct Channel *chptr,  chm_operonly(struct Client *source_p, struct Channel *chptr,
544              int parc, int *parn, char **parv, int *errors, int alev, int dir,               int parc, int *parn, char **parv, int *errors, int alev, int dir,
545              char c, unsigned int d)               char c, unsigned int d)
546  {  {
547    if ((alev < CHACCESS_HALFOP) ||    if ((alev < CHACCESS_HALFOP) ||
548        ((d == MODE_PRIVATE) && (alev < CHACCESS_CHANOP)))        ((d == MODE_PRIVATE) && (alev < CHACCESS_CHANOP)))
# Line 600  chm_operonly(struct Client *client_p, st Line 600  chm_operonly(struct Client *client_p, st
600  }  }
601    
602  static void  static void
603  chm_ban(struct Client *client_p, struct Client *source_p,  chm_ban(struct Client *source_p,
604          struct Channel *chptr, int parc, int *parn,          struct Channel *chptr, int parc, int *parn,
605          char **parv, int *errors, int alev, int dir, char c, unsigned int d)          char **parv, int *errors, int alev, int dir, char c, unsigned int d)
606  {  {
# Line 644  chm_ban(struct Client *client_p, struct Line 644  chm_ban(struct Client *client_p, struct
644    memcpy(mask, parv[*parn], sizeof(nuh_mask[*parn]));    memcpy(mask, parv[*parn], sizeof(nuh_mask[*parn]));
645    ++*parn;    ++*parn;
646    
647    if (IsServer(client_p))    if (!MyConnect(source_p))
648      if (strchr(mask, ' '))      if (strchr(mask, ' '))
649        return;        return;
650    
# Line 670  chm_ban(struct Client *client_p, struct Line 670  chm_ban(struct Client *client_p, struct
670  }  }
671    
672  static void  static void
673  chm_except(struct Client *client_p, struct Client *source_p,  chm_except(struct Client *source_p,
674             struct Channel *chptr, int parc, int *parn,             struct Channel *chptr, int parc, int *parn,
675             char **parv, int *errors, int alev, int dir, char c, unsigned int d)             char **parv, int *errors, int alev, int dir, char c, unsigned int d)
676  {  {
# Line 715  chm_except(struct Client *client_p, stru Line 715  chm_except(struct Client *client_p, stru
715    memcpy(mask, parv[*parn], sizeof(nuh_mask[*parn]));    memcpy(mask, parv[*parn], sizeof(nuh_mask[*parn]));
716    ++*parn;    ++*parn;
717    
718    if (IsServer(client_p))    if (!MyConnect(source_p))
719      if (strchr(mask, ' '))      if (strchr(mask, ' '))
720        return;        return;
721    
# Line 741  chm_except(struct Client *client_p, stru Line 741  chm_except(struct Client *client_p, stru
741  }  }
742    
743  static void  static void
744  chm_invex(struct Client *client_p, struct Client *source_p,  chm_invex(struct Client *source_p,
745            struct Channel *chptr, int parc, int *parn,            struct Channel *chptr, int parc, int *parn,
746            char **parv, int *errors, int alev, int dir, char c, unsigned int d)            char **parv, int *errors, int alev, int dir, char c, unsigned int d)
747  {  {
# Line 786  chm_invex(struct Client *client_p, struc Line 786  chm_invex(struct Client *client_p, struc
786    memcpy(mask, parv[*parn], sizeof(nuh_mask[*parn]));    memcpy(mask, parv[*parn], sizeof(nuh_mask[*parn]));
787    ++*parn;    ++*parn;
788    
789    if (IsServer(client_p))    if (!MyConnect(source_p))
790      if (strchr(mask, ' '))      if (strchr(mask, ' '))
791        return;        return;
792    
# Line 812  chm_invex(struct Client *client_p, struc Line 812  chm_invex(struct Client *client_p, struc
812  }  }
813    
814  static void  static void
815  chm_voice(struct Client *client_p, struct Client *source_p,  chm_voice(struct Client *source_p,
816            struct Channel *chptr, int parc, int *parn,            struct Channel *chptr, int parc, int *parn,
817            char **parv, int *errors, int alev, int dir, char c, unsigned int d)            char **parv, int *errors, int alev, int dir, char c, unsigned int d)
818  {  {
# Line 872  chm_voice(struct Client *client_p, struc Line 872  chm_voice(struct Client *client_p, struc
872    
873  #ifdef HALFOPS  #ifdef HALFOPS
874  static void  static void
875  chm_hop(struct Client *client_p, struct Client *source_p,  chm_hop(struct Client *source_p,
876         struct Channel *chptr, int parc, int *parn,          struct Channel *chptr, int parc, int *parn,
877         char **parv, int *errors, int alev, int dir, char c, unsigned int d)          char **parv, int *errors, int alev, int dir, char c, unsigned int d)
878  {  {
879    const char *opnick = NULL;    const char *opnick = NULL;
880    struct Client *target_p;    struct Client *target_p;
# Line 949  chm_hop(struct Client *client_p, struct Line 949  chm_hop(struct Client *client_p, struct
949  #endif  #endif
950    
951  static void  static void
952  chm_op(struct Client *client_p, struct Client *source_p,  chm_op(struct Client *source_p,
953         struct Channel *chptr, int parc, int *parn,         struct Channel *chptr, int parc, int *parn,
954         char **parv, int *errors, int alev, int dir, char c, unsigned int d)         char **parv, int *errors, int alev, int dir, char c, unsigned int d)
955  {  {
# Line 1011  chm_op(struct Client *client_p, struct C Line 1011  chm_op(struct Client *client_p, struct C
1011  }  }
1012    
1013  static void  static void
1014  chm_limit(struct Client *client_p, struct Client *source_p,  chm_limit(struct Client *source_p,
1015            struct Channel *chptr, int parc, int *parn,            struct Channel *chptr, int parc, int *parn,
1016            char **parv, int *errors, int alev, int dir, char c, unsigned int d)            char **parv, int *errors, int alev, int dir, char c, unsigned int d)
1017  {  {
# Line 1070  chm_limit(struct Client *client_p, struc Line 1070  chm_limit(struct Client *client_p, struc
1070  }  }
1071    
1072  static void  static void
1073  chm_key(struct Client *client_p, struct Client *source_p,  chm_key(struct Client *source_p,
1074          struct Channel *chptr, int parc, int *parn,          struct Channel *chptr, int parc, int *parn,
1075          char **parv, int *errors, int alev, int dir, char c, unsigned int d)          char **parv, int *errors, int alev, int dir, char c, unsigned int d)
1076  {  {
# Line 1136  chm_key(struct Client *client_p, struct Line 1136  chm_key(struct Client *client_p, struct
1136    
1137  struct ChannelMode  struct ChannelMode
1138  {  {
1139    void (*func)(struct Client *, struct Client *,    void (*func)(struct Client *,
1140                 struct Channel *, int, int *, char **,                 struct Channel *, int, int *, char **,
1141                 int *, int, int, char, unsigned int);                 int *, int, int, char, unsigned int);
1142    unsigned int d;    unsigned int d;
# Line 1461  get_channel_access(const struct Client * Line 1461  get_channel_access(const struct Client *
1461  /* rewritten to ensure parabuf < MODEBUFLEN -db */  /* rewritten to ensure parabuf < MODEBUFLEN -db */
1462    
1463  static void  static void
1464  send_mode_changes_server(struct Client *client_p, struct Client *source_p,  send_mode_changes_server(struct Client *source_p, struct Channel *chptr)
                          struct Channel *chptr)  
1465  {  {
1466    unsigned int i;    unsigned int i;
1467    int mbl, pbl, arglen, nc, mc;    int mbl, pbl, arglen, nc, mc;
# Line 1511  send_mode_changes_server(struct Client * Line 1510  send_mode_changes_server(struct Client *
1510          (pbl + arglen + BAN_FUDGE) >= MODEBUFLEN)          (pbl + arglen + BAN_FUDGE) >= MODEBUFLEN)
1511      {      {
1512        if (nc != 0)        if (nc != 0)
1513          sendto_server(client_p, NOCAPS, NOCAPS, "%s %s", modebuf, parabuf);          sendto_server(source_p, NOCAPS, NOCAPS, "%s %s", modebuf, parabuf);
1514        nc = 0;        nc = 0;
1515        mc = 0;        mc = 0;
1516    
# Line 1547  send_mode_changes_server(struct Client * Line 1546  send_mode_changes_server(struct Client *
1546      parabuf[pbl - 1] = '\0';      parabuf[pbl - 1] = '\0';
1547    
1548    if (nc != 0)    if (nc != 0)
1549      sendto_server(client_p, NOCAPS, NOCAPS, "%s %s", modebuf, parabuf);      sendto_server(source_p, NOCAPS, NOCAPS, "%s %s", modebuf, parabuf);
1550  }  }
1551    
1552  /* void send_mode_changes(struct Client *client_p,  /* void send_mode_changes(struct Client *client_p,
# Line 1562  send_mode_changes_server(struct Client * Line 1561  send_mode_changes_server(struct Client *
1561   */   */
1562  /* ensure parabuf < MODEBUFLEN -db */  /* ensure parabuf < MODEBUFLEN -db */
1563  static void  static void
1564  send_mode_changes(struct Client *client_p, struct Client *source_p,  send_mode_changes(struct Client *source_p, struct Channel *chptr)
                   struct Channel *chptr)  
1565  {  {
1566    unsigned int i;    unsigned int i;
1567    int mbl, pbl, arglen, nc, mc;    int mbl, pbl, arglen, nc, mc;
# Line 1659  send_mode_changes(struct Client *client_ Line 1657  send_mode_changes(struct Client *client_
1657    nc = 0;    nc = 0;
1658    mc = 0;    mc = 0;
1659    
1660    send_mode_changes_server(client_p, source_p, chptr);    send_mode_changes_server(source_p, chptr);
1661  }  }
1662    
1663  /* void set_channel_mode(struct Client *client_p, struct Client *source_p,  /* void set_channel_mode(struct Client *client_p, struct Client *source_p,
# Line 1674  send_mode_changes(struct Client *client_ Line 1672  send_mode_changes(struct Client *client_
1672   *               clients.   *               clients.
1673   */   */
1674  void  void
1675  set_channel_mode(struct Client *client_p, struct Client *source_p, struct Channel *chptr,  set_channel_mode(struct Client *source_p, struct Channel *chptr,
1676                   struct Membership *member, int parc, char *parv[])                   struct Membership *member, int parc, char *parv[])
1677  {  {
1678    int dir = MODE_ADD;    int dir = MODE_ADD;
# Line 1705  set_channel_mode(struct Client *client_p Line 1703  set_channel_mode(struct Client *client_p
1703        {        {
1704          struct ChannelMode *tptr = &ModeTable[(unsigned char)c];          struct ChannelMode *tptr = &ModeTable[(unsigned char)c];
1705    
1706          tptr->func(client_p, source_p, chptr, parc, &parn,          tptr->func(source_p, chptr, parc, &parn, parv,
1707                     parv, &errors, alevel, dir, c, tptr->d);                     &errors, alevel, dir, c, tptr->d);
1708          break;          break;
1709        }        }
1710      }      }
1711    }    }
1712    
1713    send_mode_changes(client_p, source_p, chptr);    send_mode_changes(source_p, chptr);
1714  }  }

Legend:
Removed from v.3149  
changed lines
  Added in v.3150

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