| 102 |
|
char line[MOTD_LINESIZE + 2]; /* +2 for \r\n */ |
| 103 |
|
char *tmp = NULL; |
| 104 |
|
unsigned int i = 0; |
| 105 |
< |
dlink_node *ptr = NULL; |
| 105 |
> |
dlink_node *node = NULL; |
| 106 |
|
|
| 107 |
|
assert(motd); |
| 108 |
|
assert(motd->path); |
| 111 |
|
return motd->cache; |
| 112 |
|
|
| 113 |
|
/* Try to find it in the list of cached files */ |
| 114 |
< |
DLINK_FOREACH(ptr, MotdList.cachelist.head) |
| 114 |
> |
DLINK_FOREACH(node, MotdList.cachelist.head) |
| 115 |
|
{ |
| 116 |
< |
cache = ptr->data; |
| 116 |
> |
cache = node->data; |
| 117 |
|
|
| 118 |
|
if (!strcmp(cache->path, motd->path) && cache->maxcount == motd->maxcount) |
| 119 |
|
{ |
| 223 |
|
static struct Motd * |
| 224 |
|
motd_lookup(const struct Client *client_p) |
| 225 |
|
{ |
| 226 |
< |
dlink_node *ptr = NULL; |
| 226 |
> |
dlink_node *node = NULL; |
| 227 |
|
const struct ClassItem *class = NULL; |
| 228 |
|
|
| 229 |
|
assert(client_p); |
| 235 |
|
assert(class); |
| 236 |
|
|
| 237 |
|
/* Check the motd blocks first */ |
| 238 |
< |
DLINK_FOREACH(ptr, MotdList.other.head) |
| 238 |
> |
DLINK_FOREACH(node, MotdList.other.head) |
| 239 |
|
{ |
| 240 |
< |
struct Motd *motd = ptr->data; |
| 240 |
> |
struct Motd *motd = node->data; |
| 241 |
|
|
| 242 |
|
switch (motd->type) |
| 243 |
|
{ |
| 334 |
|
void |
| 335 |
|
motd_recache(void) |
| 336 |
|
{ |
| 337 |
< |
dlink_node *ptr = NULL; |
| 337 |
> |
dlink_node *node = NULL; |
| 338 |
|
|
| 339 |
|
motd_decache(MotdList.local); /* Decache local and remote MOTDs */ |
| 340 |
|
motd_decache(MotdList.remote); |
| 341 |
|
|
| 342 |
< |
DLINK_FOREACH(ptr, MotdList.other.head) /* Now all the others */ |
| 343 |
< |
motd_decache(ptr->data); |
| 342 |
> |
DLINK_FOREACH(node, MotdList.other.head) /* Now all the others */ |
| 343 |
> |
motd_decache(node->data); |
| 344 |
|
|
| 345 |
|
/* Now recache local and remote MOTDs */ |
| 346 |
|
motd_cache(MotdList.local); |
| 386 |
|
void |
| 387 |
|
motd_clear(void) |
| 388 |
|
{ |
| 389 |
< |
dlink_node *ptr = NULL, *ptr_next = NULL; |
| 389 |
> |
dlink_node *node = NULL, *node_next = NULL; |
| 390 |
|
|
| 391 |
|
motd_decache(MotdList.local); /* Decache local and remote MOTDs */ |
| 392 |
|
motd_decache(MotdList.remote); |
| 393 |
|
|
| 394 |
< |
DLINK_FOREACH_SAFE(ptr, ptr_next, MotdList.other.head) /* Destroy other MOTDs */ |
| 394 |
> |
DLINK_FOREACH_SAFE(node, node_next, MotdList.other.head) /* Destroy other MOTDs */ |
| 395 |
|
{ |
| 396 |
< |
dlinkDelete(ptr, &MotdList.other); |
| 397 |
< |
motd_destroy(ptr->data); |
| 396 |
> |
dlinkDelete(node, &MotdList.other); |
| 397 |
> |
motd_destroy(node->data); |
| 398 |
|
} |
| 399 |
|
|
| 400 |
|
/* Now recache local and remote MOTDs */ |
| 408 |
|
void |
| 409 |
|
motd_report(struct Client *source_p, int parc, char *parv[]) |
| 410 |
|
{ |
| 411 |
< |
const dlink_node *ptr = NULL; |
| 411 |
> |
const dlink_node *node = NULL; |
| 412 |
|
|
| 413 |
< |
DLINK_FOREACH(ptr, MotdList.other.head) |
| 413 |
> |
DLINK_FOREACH(node, MotdList.other.head) |
| 414 |
|
{ |
| 415 |
< |
const struct Motd *motd = ptr->data; |
| 415 |
> |
const struct Motd *motd = node->data; |
| 416 |
|
|
| 417 |
|
sendto_one_numeric(source_p, &me, RPL_STATSTLINE, |
| 418 |
|
motd->mask, motd->path); |
| 425 |
|
void |
| 426 |
|
motd_memory_count(struct Client *source_p) |
| 427 |
|
{ |
| 428 |
< |
const dlink_node *ptr = NULL; |
| 428 |
> |
const dlink_node *node = NULL; |
| 429 |
|
unsigned int mt = 0; /* Motd count */ |
| 430 |
|
unsigned int mtc = 0; /* Motd cache count */ |
| 431 |
|
size_t mtm = 0; /* Memory consumed by motd */ |
| 445 |
|
mtm += MotdList.remote->path ? (strlen(MotdList.remote->path) + 1) : 0; |
| 446 |
|
} |
| 447 |
|
|
| 448 |
< |
DLINK_FOREACH(ptr, MotdList.other.head) |
| 448 |
> |
DLINK_FOREACH(node, MotdList.other.head) |
| 449 |
|
{ |
| 450 |
< |
const struct Motd *motd = ptr->data; |
| 450 |
> |
const struct Motd *motd = node->data; |
| 451 |
|
|
| 452 |
|
mt++; |
| 453 |
|
mtm += sizeof(struct Motd); |
| 454 |
|
mtm += motd->path ? (strlen(motd->path) + 1) : 0; |
| 455 |
|
} |
| 456 |
|
|
| 457 |
< |
DLINK_FOREACH(ptr, MotdList.cachelist.head) |
| 457 |
> |
DLINK_FOREACH(node, MotdList.cachelist.head) |
| 458 |
|
{ |
| 459 |
< |
const struct MotdCache *cache = ptr->data; |
| 459 |
> |
const struct MotdCache *cache = node->data; |
| 460 |
|
|
| 461 |
|
mtc++; |
| 462 |
|
mtcm += sizeof(struct MotdCache) + (MOTD_LINESIZE * (cache->count - 1)); |