Added resource_presence_t and contact_presence_t

This commit is contained in:
James Booth
2013-02-10 17:13:19 +00:00
parent 59e9b10d19
commit e922568770
17 changed files with 162 additions and 182 deletions

View File

@@ -29,7 +29,6 @@ void connection_free_resources(void);
xmpp_conn_t *connection_get_conn(void);
xmpp_ctx_t *connection_get_ctx(void);
int connection_error_handler(xmpp_stanza_t * const stanza);
void connection_set_presence_type(presence_t presence_type);
void connection_set_priority(int priority);
void connection_set_presence_message(const char * const message);

View File

@@ -153,8 +153,8 @@ _iq_handle_roster_result(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
item = xmpp_stanza_get_next(item);
}
presence_t connect_presence = accounts_get_login_presence(jabber_get_account_name());
presence_update(connect_presence, NULL, 0);
contact_presence_t conn_presence = accounts_get_login_presence(jabber_get_account_name());
presence_update(conn_presence, NULL, 0);
}
return 1;

View File

@@ -106,7 +106,7 @@ presence_free_sub_requests(void)
}
void
presence_update(presence_t presence_type, const char * const msg,
presence_update(resource_presence_t presence_type, const char * const msg,
int idle)
{
xmpp_ctx_t *ctx = connection_get_ctx();
@@ -160,7 +160,7 @@ presence_join_room(Jid *jid)
{
xmpp_ctx_t *ctx = connection_get_ctx();
xmpp_conn_t *conn = connection_get_conn();
presence_t presence_type = accounts_get_last_presence(jabber_get_account_name());
contact_presence_t presence_type = accounts_get_last_presence(jabber_get_account_name());
const char *show = stanza_get_presence_string_from_type(presence_type);
char *status = jabber_get_presence_message();
int pri = accounts_get_priority_for_presence_type(jabber_get_account_name(),
@@ -183,7 +183,7 @@ presence_change_room_nick(const char * const room, const char * const nick)
{
xmpp_ctx_t *ctx = connection_get_ctx();
xmpp_conn_t *conn = connection_get_conn();
presence_t presence_type = accounts_get_last_presence(jabber_get_account_name());
contact_presence_t presence_type = accounts_get_last_presence(jabber_get_account_name());
const char *show = stanza_get_presence_string_from_type(presence_type);
char *status = jabber_get_presence_message();
int pri = accounts_get_priority_for_presence_type(jabber_get_account_name(),

View File

@@ -664,19 +664,19 @@ stanza_attach_caps(xmpp_ctx_t * const ctx, xmpp_stanza_t * const presence)
}
const char *
stanza_get_presence_string_from_type(presence_t presence_type)
stanza_get_presence_string_from_type(resource_presence_t presence_type)
{
switch(presence_type)
{
case PRESENCE_AWAY:
case RESOURCE_AWAY:
return STANZA_TEXT_AWAY;
case PRESENCE_DND:
case RESOURCE_DND:
return STANZA_TEXT_DND;
case PRESENCE_CHAT:
case RESOURCE_CHAT:
return STANZA_TEXT_CHAT;
case PRESENCE_XA:
case RESOURCE_XA:
return STANZA_TEXT_XA;
default: // PRESENCE_ONLINE
default:
return NULL;
}
}

View File

@@ -160,6 +160,6 @@ void stanza_attach_show(xmpp_ctx_t * const ctx, xmpp_stanza_t * const presence,
void stanza_attach_status(xmpp_ctx_t * const ctx, xmpp_stanza_t * const presence,
const char * const status);
const char * stanza_get_presence_string_from_type(presence_t presence_type);
const char * stanza_get_presence_string_from_type(resource_presence_t presence_type);
#endif

View File

@@ -84,7 +84,7 @@ GList* presence_get_subscription_requests(void);
void presence_join_room(Jid *jid);
void presence_change_room_nick(const char * const room, const char * const nick);
void presence_leave_chat_room(const char * const room_jid);
void presence_update(presence_t status, const char * const msg,
void presence_update(resource_presence_t status, const char * const msg,
int idle);
// caps functions