ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/send.c
(Generate patch)

Comparing:
ircd-hybrid-7.2/src/send.c (file contents), Revision 948 by michael, Tue Jul 21 17:34:06 2009 UTC vs.
ircd-hybrid-7.3/src/send.c (file contents), Revision 1078 by michael, Sun Mar 7 22:55:05 2010 UTC

# Line 23 | Line 23
23   */
24  
25   #include "stdinc.h"
26 < #include "tools.h"
26 > #include "list.h"
27   #include "send.h"
28   #include "channel.h"
29   #include "client.h"
# Line 38 | Line 38
38   #include "s_serv.h"
39   #include "sprintf_irc.h"
40   #include "s_conf.h"
41 #include "list.h"
41   #include "s_log.h"
42   #include "memory.h"
43   #include "hook.h"
44   #include "irc_getnameinfo.h"
45   #include "packet.h"
46  
48 #define LOG_BUFSIZE 2048
47  
48   struct Callback *iosend_cb = NULL;
49   struct Callback *iosendctrl_cb = NULL;
52
53 static void send_message(struct Client *, char *, int);
54 static void send_message_remote(struct Client *, struct Client *, char *, int);
55
50   static unsigned int current_serial = 0;
51  
52 +
53   /* send_format()
54   *
55   * inputs       - buffer to format into
# Line 87 | Line 82 | send_format(char *lsendbuf, int bufsize,
82  
83    lsendbuf[len++] = '\r';
84    lsendbuf[len++] = '\n';
85 <  return (len);
85 >  return len;
86   }
87  
88   /*
# Line 294 | Line 289 | send_queued_write(struct Client *to)
289          retlen = send(to->localClient->fd.fd, first->data, first->size, 0);
290  
291        if (retlen <= 0)
297      {
298 #ifdef _WIN32
299        errno = WSAGetLastError();
300 #endif
292          break;
302      }
293  
294        dbuf_delete(&to->localClient->buf_sendq, retlen);
295  
# Line 467 | Line 457 | sendto_channel_butone(struct Client *one
457    char remote_buf[IRCD_BUFSIZE];
458    char uid_buf[IRCD_BUFSIZE];
459    int local_len, remote_len, uid_len;
460 <  dlink_node *ptr;
471 <  dlink_node *ptr_next;
472 <  struct Client *target_p;
460 >  dlink_node *ptr = NULL, *ptr_next = NULL;
461  
462    if (IsServer(from))
463      local_len = ircsprintf(local_buf, ":%s %s %s ",
# Line 500 | Line 488 | sendto_channel_butone(struct Client *one
488  
489    DLINK_FOREACH_SAFE(ptr, ptr_next, chptr->members.head)
490    {
491 <    target_p = ((struct Membership *)ptr->data)->client_p;
492 <    assert(target_p != NULL);
491 >    struct Client *target_p = ((struct Membership *)ptr->data)->client_p;
492 >
493 >    assert(IsClient(target_p));
494  
495      if (IsDefunct(target_p) || IsDeaf(target_p) || target_p->from == one)
496        continue;
497  
498 <    if (MyClient(target_p))
498 >    if (MyConnect(target_p))
499      {
500 <      if (target_p->serial != current_serial)
500 >      if (target_p->localClient->serial != current_serial)
501        {
502          send_message(target_p, local_buf, local_len);
503 <        target_p->serial = current_serial;
503 >        target_p->localClient->serial = current_serial;
504        }
505      }
506      else
# Line 519 | Line 508 | sendto_channel_butone(struct Client *one
508        /* Now check whether a message has been sent to this
509         * remote link already
510         */
511 <      if (target_p->from->serial != current_serial)
511 >      if (target_p->from->localClient->serial != current_serial)
512        {
513          if (IsCapable(target_p->from, CAP_TS6))
514            send_message_remote(target_p->from, from, uid_buf, uid_len);
515          else
516            send_message_remote(target_p->from, from, remote_buf, remote_len);
517 <        target_p->from->serial = current_serial;
517 >        target_p->from->localClient->serial = current_serial;
518        }
519      }
520    }
# Line 550 | Line 539 | sendto_channel_butone(struct Client *one
539   * -davidt
540   */
541   void
542 < sendto_server(struct Client *one,
543 <              struct Channel *chptr, unsigned long caps,
544 <              unsigned long nocaps,
542 > sendto_server(struct Client *one, const struct Channel *chptr,
543 >              const unsigned int caps,
544 >              const unsigned int nocaps,
545                const char *format, ...)
546   {
547    va_list args;
# Line 628 | Line 617 | sendto_common_channels_local(struct Clie
617        assert(target_p != NULL);
618  
619        if (!MyConnect(target_p) || target_p == user || IsDefunct(target_p) ||
620 <          target_p->serial == current_serial)
620 >          target_p->localClient->serial == current_serial)
621          continue;
622  
623 <      target_p->serial = current_serial;
623 >      target_p->localClient->serial = current_serial;
624        send_message(target_p, buffer, len);
625      }
626    }
627  
628    if (touser && MyConnect(user) && !IsDead(user) &&
629 <      user->serial != current_serial)
629 >      user->localClient->serial != current_serial)
630      send_message(user, buffer, len);
631   }
632  
# Line 737 | Line 726 | sendto_channel_local_butone(struct Clien
726   *                remote to this server.
727   */
728   void
729 < sendto_channel_remote(struct Client *one, struct Client *from, int type, int caps,
730 <                      int nocaps, struct Channel *chptr, const char *pattern, ...)
729 > sendto_channel_remote(struct Client *one, struct Client *from, int type,
730 >                      const unsigned int caps, const unsigned int nocaps,
731 >                      struct Channel *chptr, const char *pattern, ...)
732   {
733    va_list args;
734    char buffer[IRCD_BUFSIZE];
# Line 769 | Line 759 | sendto_channel_remote(struct Client *one
759          ((target_p->from->localClient->caps & caps) != caps) ||
760          ((target_p->from->localClient->caps & nocaps) != 0))
761        continue;
762 <    if (target_p->from->serial != current_serial)
762 >    if (target_p->from->localClient->serial != current_serial)
763      {
764        send_message(target_p, buffer, len);
765 <      target_p->from->serial = current_serial;
765 >      target_p->from->localClient->serial = current_serial;
766      }
767    }
768   }
# Line 798 | Line 788 | static int
788   match_it(const struct Client *one, const char *mask, int what)
789   {
790    if (what == MATCH_HOST)
791 <    return(match(mask, one->host));
791 >    return match(mask, one->host);
792  
793 <  return(match(mask, one->servptr->name));
793 >  return match(mask, one->servptr->name);
794   }
795  
796   /* sendto_match_butone()
# Line 908 | Line 898 | sendto_match_servs(struct Client *source
898      if (IsMe(target_p) || target_p->from == source_p->from)
899        continue;
900  
901 <    if (target_p->from->serial == current_serial)
901 >    if (target_p->from->localClient->serial == current_serial)
902        continue;
903  
904      if (match(mask, target_p->name))
# Line 917 | Line 907 | sendto_match_servs(struct Client *source
907         * if we set the serial here, then we'll never do a
908         * match() again, if !IsCapable()
909         */
910 <      target_p->from->serial = current_serial;
910 >      target_p->from->localClient->serial = current_serial;
911        found++;
912  
913        if (!IsCapable(target_p->from, cap))
# Line 985 | Line 975 | sendto_anywhere(struct Client *to, struc
975   void
976   sendto_realops_flags(unsigned int flags, int level, const char *pattern, ...)
977   {
978 <  struct Client *client_p;
978 >  dlink_node *ptr = NULL;
979    char nbuf[IRCD_BUFSIZE];
990  dlink_node *ptr;
980    va_list args;
981  
982    va_start(args, pattern);
# Line 996 | Line 985 | sendto_realops_flags(unsigned int flags,
985  
986    DLINK_FOREACH(ptr, oper_list.head)
987    {
988 <    client_p = ptr->data;
988 >    struct Client *client_p = ptr->data;
989      assert(client_p->umodes & UMODE_OPER);
990  
991      /* If we're sending it to opers and theyre an admin, skip.
# Line 1024 | Line 1013 | void
1013   sendto_wallops_flags(unsigned int flags, struct Client *source_p,
1014                       const char *pattern, ...)
1015   {
1016 <  struct Client *client_p;
1028 <  dlink_node *ptr;
1016 >  dlink_node *ptr = NULL;
1017    va_list args;
1018    char buffer[IRCD_BUFSIZE];
1019    int len;
# Line 1042 | Line 1030 | sendto_wallops_flags(unsigned int flags,
1030  
1031    DLINK_FOREACH(ptr, oper_list.head)
1032    {
1033 <    client_p = ptr->data;
1033 >    struct Client *client_p = ptr->data;
1034      assert(client_p->umodes & UMODE_OPER);
1035  
1036      if ((client_p->umodes & flags) && !IsDefunct(client_p))
# Line 1061 | Line 1049 | void
1049   ts_warn(const char *pattern, ...)
1050   {
1051    va_list args;
1052 <  char buffer[LOG_BUFSIZE];
1052 >  char buffer[IRCD_BUFSIZE];
1053    static time_t last = 0;
1054    static int warnings = 0;
1055  

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)