/[svn]/ircd-hybrid-7.3/src/send.c
ViewVC logotype

Diff of /ircd-hybrid-7.3/src/send.c

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

revision 1077 by michael, Sun Nov 8 13:10:50 2009 UTC revision 1078 by michael, Sun Mar 7 22:55:05 2010 UTC
# Line 44  Line 44 
44  #include "irc_getnameinfo.h"  #include "irc_getnameinfo.h"
45  #include "packet.h"  #include "packet.h"
46    
 #define LOG_BUFSIZE 2048  
47    
48  struct Callback *iosend_cb = NULL;  struct Callback *iosend_cb = NULL;
49  struct Callback *iosendctrl_cb = NULL;  struct Callback *iosendctrl_cb = NULL;
   
 static void send_message(struct Client *, char *, int);  
 static void send_message_remote(struct Client *, struct Client *, char *, int);  
   
50  static unsigned int current_serial = 0;  static unsigned int current_serial = 0;
51    
52    
53  /* send_format()  /* send_format()
54   *   *
55   * inputs       - buffer to format into   * inputs       - buffer to format into
# Line 86  send_format(char *lsendbuf, int bufsize, Line 82  send_format(char *lsendbuf, int bufsize,
82    
83    lsendbuf[len++] = '\r';    lsendbuf[len++] = '\r';
84    lsendbuf[len++] = '\n';    lsendbuf[len++] = '\n';
85    return (len);    return len;
86  }  }
87    
88  /*  /*
# Line 461  sendto_channel_butone(struct Client *one Line 457  sendto_channel_butone(struct Client *one
457    char remote_buf[IRCD_BUFSIZE];    char remote_buf[IRCD_BUFSIZE];
458    char uid_buf[IRCD_BUFSIZE];    char uid_buf[IRCD_BUFSIZE];
459    int local_len, remote_len, uid_len;    int local_len, remote_len, uid_len;
460    dlink_node *ptr;    dlink_node *ptr = NULL, *ptr_next = NULL;
   dlink_node *ptr_next;  
   struct Client *target_p;  
461    
462    if (IsServer(from))    if (IsServer(from))
463      local_len = ircsprintf(local_buf, ":%s %s %s ",      local_len = ircsprintf(local_buf, ":%s %s %s ",
# Line 494  sendto_channel_butone(struct Client *one Line 488  sendto_channel_butone(struct Client *one
488    
489    DLINK_FOREACH_SAFE(ptr, ptr_next, chptr->members.head)    DLINK_FOREACH_SAFE(ptr, ptr_next, chptr->members.head)
490    {    {
491      target_p = ((struct Membership *)ptr->data)->client_p;      struct Client *target_p = ((struct Membership *)ptr->data)->client_p;
492      assert(target_p != NULL);  
493        assert(IsClient(target_p));
494    
495      if (IsDefunct(target_p) || IsDeaf(target_p) || target_p->from == one)      if (IsDefunct(target_p) || IsDeaf(target_p) || target_p->from == one)
496        continue;        continue;
497    
498      if (MyClient(target_p))      if (MyConnect(target_p))
499      {      {
500        if (target_p->serial != current_serial)        if (target_p->localClient->serial != current_serial)
501        {        {
502          send_message(target_p, local_buf, local_len);          send_message(target_p, local_buf, local_len);
503          target_p->serial = current_serial;          target_p->localClient->serial = current_serial;
504        }        }
505      }      }
506      else      else
# Line 513  sendto_channel_butone(struct Client *one Line 508  sendto_channel_butone(struct Client *one
508        /* Now check whether a message has been sent to this        /* Now check whether a message has been sent to this
509         * remote link already         * remote link already
510         */         */
511        if (target_p->from->serial != current_serial)        if (target_p->from->localClient->serial != current_serial)
512        {        {
513          if (IsCapable(target_p->from, CAP_TS6))          if (IsCapable(target_p->from, CAP_TS6))
514            send_message_remote(target_p->from, from, uid_buf, uid_len);            send_message_remote(target_p->from, from, uid_buf, uid_len);
515          else          else
516            send_message_remote(target_p->from, from, remote_buf, remote_len);            send_message_remote(target_p->from, from, remote_buf, remote_len);
517          target_p->from->serial = current_serial;          target_p->from->localClient->serial = current_serial;
518        }        }
519      }      }
520    }    }
# Line 622  sendto_common_channels_local(struct Clie Line 617  sendto_common_channels_local(struct Clie
617        assert(target_p != NULL);        assert(target_p != NULL);
618    
619        if (!MyConnect(target_p) || target_p == user || IsDefunct(target_p) ||        if (!MyConnect(target_p) || target_p == user || IsDefunct(target_p) ||
620            target_p->serial == current_serial)            target_p->localClient->serial == current_serial)
621          continue;          continue;
622    
623        target_p->serial = current_serial;        target_p->localClient->serial = current_serial;
624        send_message(target_p, buffer, len);        send_message(target_p, buffer, len);
625      }      }
626    }    }
627    
628    if (touser && MyConnect(user) && !IsDead(user) &&    if (touser && MyConnect(user) && !IsDead(user) &&
629        user->serial != current_serial)        user->localClient->serial != current_serial)
630      send_message(user, buffer, len);      send_message(user, buffer, len);
631  }  }
632    
# Line 764  sendto_channel_remote(struct Client *one Line 759  sendto_channel_remote(struct Client *one
759          ((target_p->from->localClient->caps & caps) != caps) ||          ((target_p->from->localClient->caps & caps) != caps) ||
760          ((target_p->from->localClient->caps & nocaps) != 0))          ((target_p->from->localClient->caps & nocaps) != 0))
761        continue;        continue;
762      if (target_p->from->serial != current_serial)      if (target_p->from->localClient->serial != current_serial)
763      {      {
764        send_message(target_p, buffer, len);        send_message(target_p, buffer, len);
765        target_p->from->serial = current_serial;        target_p->from->localClient->serial = current_serial;
766      }      }
767    }    }
768  }  }
# Line 793  static int Line 788  static int
788  match_it(const struct Client *one, const char *mask, int what)  match_it(const struct Client *one, const char *mask, int what)
789  {  {
790    if (what == MATCH_HOST)    if (what == MATCH_HOST)
791      return(match(mask, one->host));      return match(mask, one->host);
792    
793    return(match(mask, one->servptr->name));    return match(mask, one->servptr->name);
794  }  }
795    
796  /* sendto_match_butone()  /* sendto_match_butone()
# Line 903  sendto_match_servs(struct Client *source Line 898  sendto_match_servs(struct Client *source
898      if (IsMe(target_p) || target_p->from == source_p->from)      if (IsMe(target_p) || target_p->from == source_p->from)
899        continue;        continue;
900    
901      if (target_p->from->serial == current_serial)      if (target_p->from->localClient->serial == current_serial)
902        continue;        continue;
903    
904      if (match(mask, target_p->name))      if (match(mask, target_p->name))
# Line 912  sendto_match_servs(struct Client *source Line 907  sendto_match_servs(struct Client *source
907         * if we set the serial here, then we'll never do a         * if we set the serial here, then we'll never do a
908         * match() again, if !IsCapable()         * match() again, if !IsCapable()
909         */         */
910        target_p->from->serial = current_serial;        target_p->from->localClient->serial = current_serial;
911        found++;        found++;
912    
913        if (!IsCapable(target_p->from, cap))        if (!IsCapable(target_p->from, cap))
# Line 980  sendto_anywhere(struct Client *to, struc Line 975  sendto_anywhere(struct Client *to, struc
975  void  void
976  sendto_realops_flags(unsigned int flags, int level, const char *pattern, ...)  sendto_realops_flags(unsigned int flags, int level, const char *pattern, ...)
977  {  {
978    struct Client *client_p;    dlink_node *ptr = NULL;
979    char nbuf[IRCD_BUFSIZE];    char nbuf[IRCD_BUFSIZE];
   dlink_node *ptr;  
980    va_list args;    va_list args;
981    
982    va_start(args, pattern);    va_start(args, pattern);
# Line 991  sendto_realops_flags(unsigned int flags, Line 985  sendto_realops_flags(unsigned int flags,
985    
986    DLINK_FOREACH(ptr, oper_list.head)    DLINK_FOREACH(ptr, oper_list.head)
987    {    {
988      client_p = ptr->data;      struct Client *client_p = ptr->data;
989      assert(client_p->umodes & UMODE_OPER);      assert(client_p->umodes & UMODE_OPER);
990    
991      /* If we're sending it to opers and theyre an admin, skip.      /* If we're sending it to opers and theyre an admin, skip.
# Line 1019  void Line 1013  void
1013  sendto_wallops_flags(unsigned int flags, struct Client *source_p,  sendto_wallops_flags(unsigned int flags, struct Client *source_p,
1014                       const char *pattern, ...)                       const char *pattern, ...)
1015  {  {
1016    struct Client *client_p;    dlink_node *ptr = NULL;
   dlink_node *ptr;  
1017    va_list args;    va_list args;
1018    char buffer[IRCD_BUFSIZE];    char buffer[IRCD_BUFSIZE];
1019    int len;    int len;
# Line 1037  sendto_wallops_flags(unsigned int flags, Line 1030  sendto_wallops_flags(unsigned int flags,
1030    
1031    DLINK_FOREACH(ptr, oper_list.head)    DLINK_FOREACH(ptr, oper_list.head)
1032    {    {
1033      client_p = ptr->data;      struct Client *client_p = ptr->data;
1034      assert(client_p->umodes & UMODE_OPER);      assert(client_p->umodes & UMODE_OPER);
1035    
1036      if ((client_p->umodes & flags) && !IsDefunct(client_p))      if ((client_p->umodes & flags) && !IsDefunct(client_p))
# Line 1056  void Line 1049  void
1049  ts_warn(const char *pattern, ...)  ts_warn(const char *pattern, ...)
1050  {  {
1051    va_list args;    va_list args;
1052    char buffer[LOG_BUFSIZE];    char buffer[IRCD_BUFSIZE];
1053    static time_t last = 0;    static time_t last = 0;
1054    static int warnings = 0;    static int warnings = 0;
1055    

Legend:
Removed from v.1077  
changed lines
  Added in v.1078

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