103 |
mr_pong(struct Client *client_p, struct Client *source_p, |
mr_pong(struct Client *client_p, struct Client *source_p, |
104 |
int parc, char *parv[]) |
int parc, char *parv[]) |
105 |
{ |
{ |
106 |
|
assert(source_p == client_p); |
107 |
|
|
108 |
if (parc == 2 && *parv[1] != '\0') |
if (parc == 2 && *parv[1] != '\0') |
109 |
{ |
{ |
110 |
if(ConfigFileEntry.ping_cookie && (source_p->flags&FLAGS_GOTUSER) && source_p->name[0]) |
if (ConfigFileEntry.ping_cookie && !source_p->localClient->registration) |
111 |
{ |
{ |
112 |
unsigned long incoming_ping = strtoul(parv[1], NULL, 10); |
unsigned long incoming_ping = strtoul(parv[1], NULL, 10); |
113 |
if(incoming_ping) |
|
114 |
{ |
if (incoming_ping) |
115 |
if(source_p->localClient->random_ping == incoming_ping) |
{ |
116 |
{ |
if (source_p->localClient->random_ping == incoming_ping) |
117 |
char buf[USERLEN+1]; |
{ |
118 |
strlcpy(buf, source_p->username, sizeof(buf)); |
char buf[USERLEN + 1]; |
119 |
SetPingCookie(source_p); |
|
120 |
register_local_user(client_p, source_p, source_p->name, buf); |
strlcpy(buf, source_p->username, sizeof(buf)); |
121 |
} |
SetPingCookie(source_p); |
122 |
else |
register_local_user(client_p, source_p, source_p->name, buf); |
123 |
{ |
} |
124 |
sendto_one(source_p, form_str(ERR_WRONGPONG), me.name, |
else |
125 |
source_p->name, source_p->localClient->random_ping); |
{ |
126 |
return; |
sendto_one(source_p, form_str(ERR_WRONGPONG), me.name, |
127 |
} |
source_p->name, source_p->localClient->random_ping); |
128 |
} |
return; |
129 |
|
} |
130 |
} |
} |
|
|
|
131 |
} |
} |
132 |
|
} |
133 |
else |
else |
134 |
sendto_one(source_p, form_str(ERR_NOORIGIN), me.name, parv[0]); |
sendto_one(source_p, form_str(ERR_NOORIGIN), me.name, parv[0]); |
135 |
} |
} |