1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-07-10 08:23:13 +02:00

Various fixes, more info later.

This commit is contained in:
Bram Matthys
2013-11-20 12:44:26 +01:00
parent 50afecfaa7
commit d8645f710d
5 changed files with 78 additions and 34 deletions
+21 -14
View File
@@ -232,14 +232,14 @@ static void clicap_generate(aClient *sptr, const char *subcmd, int flags, int cl
sendto_one(sptr, "%s :%s", buf, capbuf);
}
static void cap_ack(aClient *sptr, const char *arg)
static int cap_ack(aClient *sptr, const char *arg)
{
struct clicap *cap;
int capadd = 0, capdel = 0;
int finished = 0, negate;
if (BadPtr(arg))
return;
return 0;
for(cap = clicap_find(arg, &negate, &finished); cap;
cap = clicap_find(NULL, &negate, &finished))
@@ -262,40 +262,47 @@ static void cap_ack(aClient *sptr, const char *arg)
sptr->proto |= capadd;
sptr->proto &= ~capdel;
return 0;
}
static void cap_clear(aClient *sptr, const char *arg)
static int cap_clear(aClient *sptr, const char *arg)
{
clicap_generate(sptr, "ACK", sptr->proto ? sptr->proto : -1, 1);
sptr->proto = 0;
return 0;
}
static void cap_end(aClient *sptr, const char *arg)
static int cap_end(aClient *sptr, const char *arg)
{
if (IsRegisteredUser(sptr))
return;
return 0;
sptr->proto &= ~PROTO_CLICAP;
if (sptr->name[0] && sptr->user != NULL)
register_user(sptr, sptr, sptr->name, sptr->user->username, NULL, NULL, NULL);
return register_user(sptr, sptr, sptr->name, sptr->user->username, NULL, NULL, NULL);
return 0;
}
static void cap_list(aClient *sptr, const char *arg)
static int cap_list(aClient *sptr, const char *arg)
{
clicap_generate(sptr, "LIST", sptr->proto ? sptr->proto : -1, 0);
return 0;
}
static void cap_ls(aClient *sptr, const char *arg)
static int cap_ls(aClient *sptr, const char *arg)
{
if (!IsRegisteredUser(sptr))
sptr->proto |= PROTO_CLICAP;
clicap_generate(sptr, "LS", 0, 0);
return 0;
}
static void cap_req(aClient *sptr, const char *arg)
static int cap_req(aClient *sptr, const char *arg)
{
char buf[BUFSIZE];
char pbuf[2][BUFSIZE];
@@ -309,7 +316,7 @@ static void cap_req(aClient *sptr, const char *arg)
sptr->proto |= PROTO_CLICAP;
if (BadPtr(arg))
return;
return 0;
buflen = snprintf(buf, sizeof(buf), ":%s CAP %s ACK",
me.name, BadPtr(sptr->name) ? "*" : sptr->name);
@@ -369,7 +376,7 @@ static void cap_req(aClient *sptr, const char *arg)
if (!finished)
{
sendto_one(sptr, ":%s CAP %s NAK :%s", me.name, BadPtr(sptr->name) ? "*" : sptr->name, arg);
return;
return 0;
}
if (i)
@@ -382,11 +389,12 @@ static void cap_req(aClient *sptr, const char *arg)
sptr->proto |= capadd;
sptr->proto &= ~capdel;
return 0;
}
struct clicap_cmd {
const char *cmd;
void (*func)(struct Client *source_p, const char *arg);
int (*func)(struct Client *source_p, const char *arg);
};
static struct clicap_cmd clicap_cmdtable[] = {
@@ -437,8 +445,7 @@ DLLFUNC int m_cap(aClient *cptr, aClient *sptr, int parc, char *parv[])
return 0;
}
(cmd->func)(sptr, parv[2]);
return 0;
return (cmd->func)(sptr, parv[2]);
}
/* This is called on module init, before Server Ready */
+7 -5
View File
@@ -864,6 +864,8 @@ int _register_user(aClient *cptr, aClient *sptr, char *nick, char *username, cha
if (MyConnect(sptr))
{
char temp[USERLEN + 1];
if ((i = check_client(sptr, username))) {
/* This had return i; before -McSkaf */
if (i == -5)
@@ -909,16 +911,16 @@ int _register_user(aClient *cptr, aClient *sptr, char *nick, char *username, cha
*
* Moved the noident stuff here. -OnyxDragon
*/
/* because username may point to user->username */
strncpyzt(temp, username, USERLEN + 1);
if (!(sptr->flags & FLAGS_DOID))
strncpyzt(user->username, username, USERLEN + 1);
strncpyzt(user->username, temp, USERLEN + 1);
else if (sptr->flags & FLAGS_GOTID)
strncpyzt(user->username, sptr->username, USERLEN + 1);
else
{
/* because username may point to user->username */
char temp[USERLEN + 1];
strncpyzt(temp, username, USERLEN + 1);
if (IDENT_CHECK == 0) {
strncpyzt(user->username, temp, USERLEN + 1);
}