1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Moved chat room leave presence creation to stanza module

This commit is contained in:
James Booth 2012-11-09 01:36:53 +00:00
parent 8099dfbde6
commit ca75c1c231
3 changed files with 10 additions and 11 deletions

View File

@ -246,19 +246,12 @@ void
jabber_leave_chat_room(const char * const room_jid)
{
char *nick = room_get_nick_for_room(room_jid);
GString *full_jid = g_string_new(room_jid);
g_string_append(full_jid, "/");
g_string_append(full_jid, nick);
xmpp_stanza_t *presence = xmpp_stanza_new(jabber_conn.ctx);
xmpp_stanza_set_name(presence, STANZA_NAME_PRESENCE);
xmpp_stanza_set_type(presence, STANZA_TYPE_UNAVAILABLE);
xmpp_stanza_set_attribute(presence, STANZA_ATTR_TO, full_jid->str);
xmpp_stanza_t *presence = stanza_create_room_leave(jabber_conn.ctx,
room_jid, nick);
xmpp_send(jabber_conn.conn, presence);
xmpp_stanza_release(presence);
g_string_free(full_jid, TRUE);
room_leave(room_jid);
}

View File

@ -98,7 +98,7 @@ stanza_create_room_presence(xmpp_ctx_t *ctx, const char * const room,
return presence;
}
/*
xmpp_stanza_t *
stanza_create_room_leave(xmpp_ctx_t *ctx, const char * const room,
const char * const nick)
@ -110,7 +110,9 @@ stanza_create_room_leave(xmpp_ctx_t *ctx, const char * const room,
xmpp_stanza_t *presence = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(presence, STANZA_NAME_PRESENCE);
xmpp_stanza_set_type(presence, STANZA_TYPE_UNAVAILABLE);
xmpp_stanza_set_attribute(presence, STANZA_ATTR_TO, full_jid->str);
g_string_free(full_jid, TRUE);
return presence;
}
*/

View File

@ -77,4 +77,8 @@ xmpp_stanza_t* stanza_create_message(xmpp_ctx_t *ctx,
xmpp_stanza_t* stanza_create_room_presence(xmpp_ctx_t *ctx,
const char * const room, const char * const nick);
xmpp_stanza_t* stanza_create_room_leave(xmpp_ctx_t *ctx,
const char * const room, const char * const nick);
#endif