mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-31 07:06:21 +00:00
Implemented setting affiliation and listing affiliations
This commit is contained in:
@@ -529,14 +529,13 @@ stanza_create_room_config_cancel_iq(xmpp_ctx_t *ctx, const char * const room_jid
|
||||
}
|
||||
|
||||
xmpp_stanza_t *
|
||||
stanza_create_room_owner_add_iq(xmpp_ctx_t *ctx, const char * const room, const char * const jid,
|
||||
const char * const reason)
|
||||
stanza_create_room_affiliation_list_iq(xmpp_ctx_t *ctx, const char * const room, const char * const affiliation)
|
||||
{
|
||||
xmpp_stanza_t *iq = xmpp_stanza_new(ctx);
|
||||
xmpp_stanza_set_name(iq, STANZA_NAME_IQ);
|
||||
xmpp_stanza_set_type(iq, STANZA_TYPE_SET);
|
||||
xmpp_stanza_set_type(iq, STANZA_TYPE_GET);
|
||||
xmpp_stanza_set_attribute(iq, STANZA_ATTR_TO, room);
|
||||
char *id = create_unique_id("owner_add");
|
||||
char *id = create_unique_id("affiliation_get");
|
||||
xmpp_stanza_set_id(iq, id);
|
||||
free(id);
|
||||
|
||||
@@ -546,20 +545,7 @@ stanza_create_room_owner_add_iq(xmpp_ctx_t *ctx, const char * const room, const
|
||||
|
||||
xmpp_stanza_t *item = xmpp_stanza_new(ctx);
|
||||
xmpp_stanza_set_name(item, STANZA_NAME_ITEM);
|
||||
xmpp_stanza_set_attribute(item, "affiliation", "owner");
|
||||
xmpp_stanza_set_attribute(item, STANZA_ATTR_JID, jid);
|
||||
|
||||
if (reason) {
|
||||
xmpp_stanza_t *reason_st = xmpp_stanza_new(ctx);
|
||||
xmpp_stanza_set_name(reason_st, STANZA_NAME_REASON);
|
||||
xmpp_stanza_t *reason_text = xmpp_stanza_new(ctx);
|
||||
xmpp_stanza_set_text(reason_text, reason);
|
||||
xmpp_stanza_add_child(reason_st, reason_text);
|
||||
xmpp_stanza_release(reason_text);
|
||||
|
||||
xmpp_stanza_add_child(item, reason_st);
|
||||
xmpp_stanza_release(reason_st);
|
||||
}
|
||||
xmpp_stanza_set_attribute(item, "affiliation", affiliation);
|
||||
|
||||
xmpp_stanza_add_child(query, item);
|
||||
xmpp_stanza_release(item);
|
||||
@@ -570,14 +556,14 @@ stanza_create_room_owner_add_iq(xmpp_ctx_t *ctx, const char * const room, const
|
||||
}
|
||||
|
||||
xmpp_stanza_t *
|
||||
stanza_create_room_owner_remove_iq(xmpp_ctx_t *ctx, const char * const room, const char * const jid,
|
||||
const char * const reason)
|
||||
stanza_create_room_affiliation_set_iq(xmpp_ctx_t *ctx, const char * const room, const char * const jid,
|
||||
const char * const affiliation, const char * const reason)
|
||||
{
|
||||
xmpp_stanza_t *iq = xmpp_stanza_new(ctx);
|
||||
xmpp_stanza_set_name(iq, STANZA_NAME_IQ);
|
||||
xmpp_stanza_set_type(iq, STANZA_TYPE_SET);
|
||||
xmpp_stanza_set_attribute(iq, STANZA_ATTR_TO, room);
|
||||
char *id = create_unique_id("owner_remove");
|
||||
char *id = create_unique_id("affiliation_set");
|
||||
xmpp_stanza_set_id(iq, id);
|
||||
free(id);
|
||||
|
||||
@@ -587,7 +573,7 @@ stanza_create_room_owner_remove_iq(xmpp_ctx_t *ctx, const char * const room, con
|
||||
|
||||
xmpp_stanza_t *item = xmpp_stanza_new(ctx);
|
||||
xmpp_stanza_set_name(item, STANZA_NAME_ITEM);
|
||||
xmpp_stanza_set_attribute(item, "affiliation", "admin");
|
||||
xmpp_stanza_set_attribute(item, "affiliation", affiliation);
|
||||
xmpp_stanza_set_attribute(item, STANZA_ATTR_JID, jid);
|
||||
|
||||
if (reason) {
|
||||
|
||||
Reference in New Issue
Block a user