> I don't change name of user and, of course, I receive error 007 - nick
> used. What can I do? Drop previous user from Ape? If it is possible,
> can you write me a piece of code to drop user?
>
> I droped previous user for my app, in this way(modify the cmd_connect() in
cmd.c):

unsigned int cmd_connect(callbackp *callbacki)
{
    USERS *nuser;
    RAW *newraw;
    json_item *jstr = NULL;
    char *uin;

    JNEED_STR(callbacki->param, "uin", uin, RETURN_BAD_PARAMS);

    if (GET_USER_FROM_APE(callbacki->g_ape, uin) != NULL) {
        if (atoi(CONFIG_VAL(Server, enable_user_reconnect,
                            callbacki->g_ape->srv)) == 1) {
            deluser(GET_USER_FROM_APE(callbacki->g_ape, uin),
callbacki->g_ape);
        } else {
            hn_senderr(callbacki, "007", "ERR_UIN_USED");
            return (RETURN_NOTHING);
        }
    }

    nuser = adduser(NULL, NULL, NULL, callbacki->call_user,
callbacki->g_ape);
    callbacki->call_user = nuser;

    subuser_restor(getsubuser(callbacki->call_user, callbacki->host),
callbacki->g_ape);

    ADD_UIN_FOR_USER(nuser, uin);
    SET_USER_FOR_APE(callbacki->g_ape, uin, nuser);

    ...
}



#define SET_USER_FOR_APE(ape, uin, user)                                \
    do {                                                                \
        hashtbl_append(get_property(ape->properties, "userlist")->val,    \
                       uin, user);                                        \
    } while (0)
#define GET_USER_FROM_APE(ape, uin)                                        \
    (get_property(ape->properties, "userlist") != NULL ?                \
     hashtbl_seek(get_property(ape->properties, "userlist")->val, uin):
NULL)

-- 
You received this message because you are subscribed to the Google
Groups "APE Project" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/ape-project?hl=en
---
APE Project (Ajax Push Engine)
Official website : http://www.ape-project.org/
Git Hub : http://github.com/APE-Project/

Reply via email to