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

Comparing ircd-hybrid/trunk/src/client.c (file contents):
Revision 1734 by michael, Fri Jan 11 12:59:24 2013 UTC vs.
Revision 1991 by michael, Thu May 9 16:01:15 2013 UTC

# Line 51 | Line 51
51   #include "irc_res.h"
52   #include "userhost.h"
53   #include "watch.h"
54 + #include "rng_mt.h"
55  
56   dlink_list listing_client_list = { NULL, NULL, 0 };
57   /* Pointer to beginning of Client list */
# Line 77 | Line 78 | static void check_unknowns_list(void);
78   static void ban_them(struct Client *, struct MaskItem *);
79  
80  
81 < /* init_client()
81 > /* client_init()
82   *
83   * inputs       - NONE
84   * output       - NONE
85   * side effects - initialize client free memory
86   */
87   void
88 < init_client(void)
88 > client_init(void)
89   {
90    /* start off the check ping event ..  -- adrian
91     * Every 30 seconds is plenty -- db
# Line 390 | Line 391 | check_conf_klines(void)
391      }
392  
393      if ((conf = find_matching_name_conf(CONF_XLINE,  client_p->info,
394 <                                        NULL, NULL, 0)) != NULL ||
394 <        (conf = find_matching_name_conf(CONF_RXLINE, client_p->info,
395 <                                        NULL, NULL, 0)) != NULL)
394 >                                        NULL, NULL, 0)))
395      {
396        ban_them(client_p, conf);
397        continue;
# Line 435 | Line 434 | ban_them(struct Client *client_p, struct
434  
435    switch (conf->type)
436    {
438 –    case CONF_RKLINE:
437      case CONF_KLINE:
438        type_string = kline_string;
439        break;
# Line 445 | Line 443 | ban_them(struct Client *client_p, struct
443      case CONF_GLINE:
444        type_string = gline_string;
445        break;
448 –    case CONF_RXLINE:
446      case CONF_XLINE:
447        type_string = xline_string;
448        ++conf->count;
# Line 921 | Line 918 | exit_client(struct Client *source_p, str
918      */
919      close_connection(source_p);
920    }
921 +  else if (IsClient(source_p) && HasFlag(source_p->servptr, FLAGS_EOB))
922 +    sendto_realops_flags(UMODE_FARCONNECT, L_ALL, SEND_NOTICE,
923 +                         "Client exiting at %s: %s (%s@%s) [%s]",
924 +                         source_p->servptr->name, source_p->name,
925 +                         source_p->username, source_p->host, comment);
926  
927    if (IsServer(source_p))
928    {
# Line 1174 | Line 1176 | del_all_accepts(struct Client *client_p)
1176    DLINK_FOREACH_SAFE(ptr, next_ptr, client_p->localClient->acceptlist.head)
1177      del_accept(ptr->data, client_p);
1178   }
1179 +
1180 + unsigned int
1181 + idle_time_get(const struct Client *source_p, const struct Client *target_p)
1182 + {
1183 +  unsigned int idle = 0;
1184 +  unsigned int min_idle = 0;
1185 +  unsigned int max_idle = 0;
1186 +  const struct ClassItem *class = get_class_ptr(&target_p->localClient->confs);
1187 +
1188 +  if (!(class->flags & CLASS_FLAGS_FAKE_IDLE) || target_p == source_p)
1189 +    return CurrentTime - target_p->localClient->last_privmsg;
1190 +  if (HasUMode(source_p, UMODE_OPER) &&
1191 +      !(class->flags & CLASS_FLAGS_HIDE_IDLE_FROM_OPERS))
1192 +    return CurrentTime - target_p->localClient->last_privmsg;
1193 +
1194 +  min_idle = class->min_idle;
1195 +  max_idle = class->max_idle;
1196 +
1197 +  if (min_idle == max_idle)
1198 +    return min_idle;
1199 +
1200 +  if (class->flags & CLASS_FLAGS_RANDOM_IDLE)
1201 +    idle = genrand_int32();
1202 +  else
1203 +    idle = CurrentTime - target_p->localClient->last_privmsg;
1204 +
1205 +  if (max_idle == 0)
1206 +    idle = 0;
1207 +  else
1208 +    idle %= max_idle;
1209 +
1210 +  if (idle < min_idle)
1211 +    idle = min_idle + (idle % (max_idle - min_idle));
1212 +
1213 +  return idle;
1214 + }

Diff Legend

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