mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-26 04:46:21 +00:00
initial register command test
This commit is contained in:
@@ -2751,6 +2751,40 @@ stanza_change_password(xmpp_ctx_t* ctx, const char* const user, const char* cons
|
||||
return iq;
|
||||
}
|
||||
|
||||
xmpp_stanza_t*
|
||||
stanza_register_new_account(xmpp_ctx_t* ctx, const char* const user, const char* const password)
|
||||
{
|
||||
char* id = connection_create_stanza_id();
|
||||
xmpp_stanza_t* iq = xmpp_iq_new(ctx, STANZA_TYPE_SET, id);
|
||||
free(id);
|
||||
|
||||
xmpp_stanza_t* register_new_account = xmpp_stanza_new(ctx);
|
||||
xmpp_stanza_set_name(register_new_account, STANZA_NAME_QUERY);
|
||||
xmpp_stanza_set_ns(register_new_account, STANZA_NS_REGISTER);
|
||||
|
||||
xmpp_stanza_t* username_st = xmpp_stanza_new(ctx);
|
||||
xmpp_stanza_set_name(username_st, STANZA_NAME_USERNAME);
|
||||
xmpp_stanza_t* username_text = xmpp_stanza_new(ctx);
|
||||
xmpp_stanza_set_text(username_text, user);
|
||||
xmpp_stanza_add_child(username_st, username_text);
|
||||
xmpp_stanza_release(username_text);
|
||||
|
||||
xmpp_stanza_t* password_st = xmpp_stanza_new(ctx);
|
||||
xmpp_stanza_set_name(password_st, STANZA_NAME_PASSWORD);
|
||||
xmpp_stanza_t* password_text = xmpp_stanza_new(ctx);
|
||||
xmpp_stanza_set_text(password_text, password);
|
||||
xmpp_stanza_add_child(password_st, password_text);
|
||||
xmpp_stanza_release(password_text);
|
||||
|
||||
xmpp_stanza_add_child(register_new_account, username_st);
|
||||
xmpp_stanza_release(username_st);
|
||||
|
||||
xmpp_stanza_add_child(register_new_account, password_st);
|
||||
xmpp_stanza_release(password_st);
|
||||
|
||||
return iq;
|
||||
}
|
||||
|
||||
xmpp_stanza_t*
|
||||
stanza_request_voice(xmpp_ctx_t* ctx, const char* const room)
|
||||
{
|
||||
@@ -2889,3 +2923,4 @@ stanza_get_service_contact_addresses(xmpp_ctx_t* ctx, xmpp_stanza_t* stanza)
|
||||
|
||||
return addresses;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user