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/trunk/src/send.c (file contents):
Revision 3136 by michael, Tue Mar 11 18:24:03 2014 UTC vs.
Revision 3189 by michael, Fri Mar 21 18:18:00 2014 UTC

# Line 160 | Line 160 | send_message_remote(struct Client *to, s
160  
161      sendto_server(NULL, NOCAPS, NOCAPS,
162                    ":%s KILL %s :%s (%s[%s@%s] Ghosted %s)",
163 <                  me.id, to->name, me.name, to->name,
163 >                  me.id, to->id, me.name, to->name,
164                    to->username, to->host, to->from->name);
165  
166      AddFlag(to, FLAGS_KILLED);
# Line 169 | Line 169 | send_message_remote(struct Client *to, s
169        sendto_one_numeric(from, &me, ERR_GHOSTEDCLIENT, to->name,
170                           to->username, to->host, to->from);
171  
172 <    exit_client(to, &me, "Ghosted client");
172 >    exit_client(to, "Ghosted client");
173      return;
174    }
175  
# Line 306 | Line 306 | void
306   sendto_one(struct Client *to, const char *pattern, ...)
307   {
308    va_list args;
309 <  struct dbuf_block *buffer;
310 <
311 <  to = to->from;
309 >  struct dbuf_block *buffer = NULL;
310  
311 <  if (IsDead(to))
311 >  if (IsDead(to->from))
312      return;  /* This socket has already been marked as dead */
313  
314    buffer = dbuf_alloc();
# Line 319 | Line 317 | sendto_one(struct Client *to, const char
317    send_format(buffer, pattern, args);
318    va_end(args);
319  
320 <  send_message(to, buffer);
320 >  send_message(to->from, buffer);
321  
322    dbuf_ref_free(buffer);
323   }
# Line 327 | Line 325 | sendto_one(struct Client *to, const char
325   void
326   sendto_one_numeric(struct Client *to, struct Client *from, enum irc_numerics numeric, ...)
327   {
328 <  struct dbuf_block *buffer;
328 >  struct dbuf_block *buffer = NULL;
329 >  const char *dest = NULL;
330    va_list args;
332  const char *dest;
333
334  to = to->from;
331  
332 <  if (IsDead(to))
332 >  if (IsDead(to->from))
333      return;
334  
335    dest = ID_or_name(to, to);
# Line 348 | Line 344 | sendto_one_numeric(struct Client *to, st
344    send_format(buffer, numeric_form(numeric), args);
345    va_end(args);
346  
347 <  send_message(to, buffer);
347 >  send_message(to->from, buffer);
348  
349    dbuf_ref_free(buffer);
350   }
# Line 356 | Line 352 | sendto_one_numeric(struct Client *to, st
352   void
353   sendto_one_notice(struct Client *to, struct Client *from, const char *pattern, ...)
354   {
355 <  struct dbuf_block *buffer;
355 >  struct dbuf_block *buffer = NULL;
356 >  const char *dest = NULL;
357    va_list args;
361  const char *dest;
362
363  to = to->from;
358  
359 <  if (IsDead(to))
359 >  if (IsDead(to->from))
360      return;
361  
362    dest = ID_or_name(to, to);
# Line 377 | Line 371 | sendto_one_notice(struct Client *to, str
371    send_format(buffer, pattern, args);
372    va_end(args);
373  
374 <  send_message(to, buffer);
374 >  send_message(to->from, buffer);
375  
376    dbuf_ref_free(buffer);
377   }
# Line 409 | Line 403 | sendto_channel_butone(struct Client *one
403    else
404      dbuf_put_fmt(local_buf, ":%s!%s@%s ", from->name, from->username, from->host);
405  
406 <  dbuf_put_fmt(remote_buf, ":%s ", ID(from));
406 >  dbuf_put_fmt(remote_buf, ":%s ", from->id);
407  
408    va_start(alocal, pattern);
409    va_start(aremote, pattern);
# Line 428 | Line 422 | sendto_channel_butone(struct Client *one
422  
423      assert(IsClient(target_p));
424  
425 <    if (IsDefunct(target_p) || HasUMode(target_p, UMODE_DEAF) || target_p->from == one)
425 >    if (IsDefunct(target_p) || HasUMode(target_p, UMODE_DEAF) ||
426 >        (one && target_p->from == one->from))
427        continue;
428  
429      if (type != 0 && (ms->flags & type) == 0)
# Line 638 | Line 633 | sendto_channel_local_butone(struct Clien
633      if (type != 0 && (ms->flags & type) == 0)
634        continue;
635  
636 <    if (!MyConnect(target_p) || target_p == one ||
637 <        IsDefunct(target_p) || HasUMode(target_p, UMODE_DEAF))
636 >    if (!MyConnect(target_p) || (one && target_p == one->from))
637 >      continue;
638 >
639 >    if (IsDefunct(target_p) || HasUMode(target_p, UMODE_DEAF))
640        continue;
641  
642      if (HasCap(target_p, cap) != cap)
# Line 685 | Line 682 | match_it(const struct Client *one, const
682   * ugh. ONLY used by m_message.c to send an "oper magic" message. ugh.
683   */
684   void
685 < sendto_match_butone(struct Client *one, struct Client *from, char *mask,
685 > sendto_match_butone(struct Client *one, struct Client *from, const char *mask,
686                      int what, const char *pattern, ...)
687   {
688    va_list alocal, aremote;
# Line 695 | Line 692 | sendto_match_butone(struct Client *one,
692    local_buf = dbuf_alloc(), remote_buf = dbuf_alloc();
693  
694    dbuf_put_fmt(local_buf, ":%s!%s@%s ", from->name, from->username, from->host);
695 <  dbuf_put_fmt(remote_buf, ":%s ", ID(from));
695 >  dbuf_put_fmt(remote_buf, ":%s ", from->id);
696  
697    va_start(alocal, pattern);
698    va_start(aremote, pattern);
# Line 709 | Line 706 | sendto_match_butone(struct Client *one,
706    {
707      struct Client *client_p = ptr->data;
708  
709 <    if (client_p != one && !IsDefunct(client_p) &&
709 >    if ((!one || client_p != one->from) && !IsDefunct(client_p) &&
710          match_it(client_p, mask, what))
711        send_message(client_p, local_buf);
712    }
# Line 743 | Line 740 | sendto_match_butone(struct Client *one,
740       * server deal with it.
741       * -wnder
742       */
743 <    if (client_p != one && !IsDefunct(client_p))
743 >    if ((!one || client_p != one->from) && !IsDefunct(client_p))
744        send_message_remote(client_p, from, remote_buf);
745    }
746  
# Line 771 | Line 768 | sendto_match_servs(struct Client *source
768    buff_suid = dbuf_alloc();
769  
770    va_start(args, pattern);
771 <  dbuf_put_fmt(buff_suid, ":%s ", ID(source_p));
771 >  dbuf_put_fmt(buff_suid, ":%s ", source_p->id);
772    dbuf_put_args(buff_suid, pattern, args);
773    va_end(args);
774  
# Line 821 | Line 818 | sendto_anywhere(struct Client *to, struc
818                  const char *pattern, ...)
819   {
820    va_list args;
821 <  struct dbuf_block *buffer;
821 >  struct dbuf_block *buffer = NULL;
822  
823    if (IsDead(to->from))
824      return;
825  
826    buffer = dbuf_alloc();
827  
828 <  if (MyClient(to))
829 <  {
830 <    if (IsServer(from))
834 <      dbuf_put_fmt(buffer, ":%s %s %s ", from->name, command, to->name);
835 <    else
836 <      dbuf_put_fmt(buffer, ":%s!%s@%s %s %s ", from->name, from->username, from->host, command, to->name);
837 <  }
828 >  if (MyClient(to) && IsClient(from))
829 >    dbuf_put_fmt(buffer, ":%s!%s@%s %s %s ", from->name, from->username,
830 >                 from->host, command, to->name);
831    else
832 <    dbuf_put_fmt(buffer, ":%s %s %s ", ID_or_name(from, to), command, ID_or_name(to, to));
832 >    dbuf_put_fmt(buffer, ":%s %s %s ", ID_or_name(from, to),
833 >                 command, ID_or_name(to, to));
834  
835    va_start(args, pattern);
836    send_format(buffer, pattern, args);
# Line 983 | Line 977 | sendto_realops_flags_ratelimited(const c
977    sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, "%s", buffer);
978    ilog(LOG_TYPE_IRCD, "%s", buffer);
979   }
986
987 /* kill_client()
988 *
989 * inputs       - client to send kill towards
990 *              - pointer to client to kill
991 *              - reason for kill
992 * output       - NONE
993 * side effects - NONE
994 */
995 void
996 kill_client(struct Client *client_p, struct Client *diedie,
997            const char *pattern, ...)
998 {
999  va_list args;
1000  struct dbuf_block *buffer;
1001
1002  client_p = client_p->from;
1003
1004  if (IsDead(client_p))
1005    return;
1006
1007  buffer = dbuf_alloc();
1008
1009  dbuf_put_fmt(buffer, ":%s KILL %s :",
1010               ID_or_name(&me, client_p),
1011               ID_or_name(diedie, client_p));
1012
1013  va_start(args, pattern);
1014  send_format(buffer, pattern, args);
1015  va_end(args);
1016
1017  send_message(client_p, buffer);
1018
1019  dbuf_ref_free(buffer);
1020 }
1021
1022 /* kill_client_serv_butone()
1023 *
1024 * inputs       - pointer to client to not send to
1025 *              - pointer to client to kill
1026 * output       - NONE
1027 * side effects - Send a KILL for the given client
1028 *                message to all connected servers
1029 *                except the client 'one'. Also deal with
1030 *                client being unknown to leaf, as in lazylink...
1031 */
1032 void
1033 kill_client_serv_butone(struct Client *one, struct Client *source_p,
1034                        const char *pattern, ...)
1035 {
1036  va_list args;
1037  dlink_node *ptr = NULL;
1038  struct dbuf_block *uid_buffer = dbuf_alloc();
1039
1040  va_start(args, pattern);
1041  dbuf_put_fmt(uid_buffer, ":%s KILL %s :", ID(&me), ID(source_p));
1042  send_format(uid_buffer, pattern, args);
1043  va_end(args);
1044
1045  DLINK_FOREACH(ptr, serv_list.head)
1046  {
1047    struct Client *client_p = ptr->data;
1048
1049    if (one != NULL && (client_p == one->from))
1050      continue;
1051    if (IsDefunct(client_p))
1052      continue;
1053
1054    send_message(client_p, uid_buffer);
1055  }
1056
1057  dbuf_ref_free(uid_buffer);
1058 }

Diff Legend

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