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

Comparing ircd-hybrid/trunk/src/whowas.c (file contents):
Revision 5347 by michael, Sun Jan 11 12:42:20 2015 UTC vs.
Revision 6719 by michael, Fri Oct 30 18:18:07 2015 UTC

# Line 48 | Line 48 | void
48   whowas_add_history(struct Client *client_p, const int online)
49   {
50    static unsigned int whowas_next = 0;
51 <  struct Whowas *const who = &WHOWAS[whowas_next];
51 >  struct Whowas *const whowas = &WHOWAS[whowas_next];
52  
53    assert(IsClient(client_p));
54  
55    if (++whowas_next == NICKNAMEHISTORYLENGTH)
56      whowas_next = 0;
57  
58 <  if (who->hashv != -1)
58 >  if (whowas->hashv != -1)
59    {
60 <    if (who->online)
61 <      dlinkDelete(&who->cnode, &who->online->whowas);
60 >    if (whowas->online)
61 >      dlinkDelete(&whowas->cnode, &whowas->online->whowas);
62  
63 <    dlinkDelete(&who->tnode, &WHOWASHASH[who->hashv]);
63 >    dlinkDelete(&whowas->tnode, &WHOWASHASH[whowas->hashv]);
64    }
65  
66 <  who->hashv = strhash(client_p->name);
67 <  who->shide = IsHidden(client_p->servptr) != 0;
68 <  who->logoff = CurrentTime;
69 <
70 <  strlcpy(who->account, client_p->account, sizeof(who->account));
71 <  strlcpy(who->name, client_p->name, sizeof(who->name));
72 <  strlcpy(who->username, client_p->username, sizeof(who->username));
73 <  strlcpy(who->hostname, client_p->host, sizeof(who->hostname));
74 <  strlcpy(who->realname, client_p->info, sizeof(who->realname));
75 <  strlcpy(who->servername, client_p->servptr->name, sizeof(who->servername));
66 >  whowas->hashv = strhash(client_p->name);
67 >  whowas->shide = IsHidden(client_p->servptr) != 0;
68 >  whowas->logoff = CurrentTime;
69 >
70 >  strlcpy(whowas->account, client_p->account, sizeof(whowas->account));
71 >  strlcpy(whowas->name, client_p->name, sizeof(whowas->name));
72 >  strlcpy(whowas->username, client_p->username, sizeof(whowas->username));
73 >  strlcpy(whowas->hostname, client_p->host, sizeof(whowas->hostname));
74 >  strlcpy(whowas->sockhost, client_p->sockhost, sizeof(whowas->sockhost));
75 >  strlcpy(whowas->realname, client_p->info, sizeof(whowas->realname));
76 >  strlcpy(whowas->servername, client_p->servptr->name, sizeof(whowas->servername));
77  
78    if (online)
79    {
80 <    who->online = client_p;
81 <    dlinkAdd(who, &who->cnode, &client_p->whowas);
80 >    whowas->online = client_p;
81 >    dlinkAdd(whowas, &whowas->cnode, &client_p->whowas);
82    }
83    else
84 <    who->online = NULL;
84 >    whowas->online = NULL;
85  
86 <  dlinkAdd(who, &who->tnode, &WHOWASHASH[who->hashv]);
86 >  dlinkAdd(whowas, &whowas->tnode, &WHOWASHASH[whowas->hashv]);
87   }
88  
89   void
# Line 92 | Line 93 | whowas_off_history(struct Client *client
93  
94    DLINK_FOREACH_SAFE(node, node_next, client_p->whowas.head)
95    {
96 <    struct Whowas *temp = node->data;
96 >    struct Whowas *whowas = node->data;
97  
98 <    temp->online = NULL;
99 <    dlinkDelete(&temp->cnode, &client_p->whowas);
98 >    whowas->online = NULL;
99 >    dlinkDelete(&whowas->cnode, &client_p->whowas);
100    }
101   }
102  
# Line 108 | Line 109 | whowas_get_history(const char *nick, tim
109  
110    DLINK_FOREACH(node, WHOWASHASH[strhash(nick)].head)
111    {
112 <    struct Whowas *temp = node->data;
112 >    struct Whowas *whowas = node->data;
113  
114 <    if (temp->logoff < timelimit)
114 >    if (whowas->logoff < timelimit)
115        continue;
116 <    if (irccmp(nick, temp->name))
116 >    if (irccmp(nick, whowas->name))
117        continue;
118 <    return temp->online;
118 >    return whowas->online;
119    }
120  
121    return NULL;
122   }
123  
124   void
125 < whowas_count_memory(unsigned int *const count, uint64_t *const bytes)
125 > whowas_count_memory(unsigned int *const count, size_t *const bytes)
126   {
127 <  const struct Whowas *tmp = &WHOWAS[0];
127 >  const struct Whowas *whowas = &WHOWAS[0];
128  
129 <  for (unsigned int i = 0; i < NICKNAMEHISTORYLENGTH; ++i, ++tmp)
129 >  for (unsigned int i = 0; i < NICKNAMEHISTORYLENGTH; ++i, ++whowas)
130    {
131 <    if (tmp->hashv != -1)
131 >    if (whowas->hashv != -1)
132      {
133        (*count)++;
134        (*bytes) += sizeof(struct Whowas);

Diff Legend

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