1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00

Moved roster handlers to server_events

This commit is contained in:
James Booth 2014-01-05 21:55:32 +00:00
parent 4bcd766d34
commit b8672d709a
5 changed files with 32 additions and 29 deletions

View File

@ -133,22 +133,6 @@ prof_handle_not_in_group(const char * const contact,
ui_current_page_off(); ui_current_page_off();
} }
void
prof_handle_group_add(const char * const contact,
const char * const group)
{
ui_group_added(contact, group);
ui_current_page_off();
}
void
prof_handle_group_remove(const char * const contact,
const char * const group)
{
ui_group_removed(contact, group);
ui_current_page_off();
}
void void
prof_handle_roster_add(const char * const barejid, const char * const name) prof_handle_roster_add(const char * const barejid, const char * const name)
{ {
@ -156,13 +140,6 @@ prof_handle_roster_add(const char * const barejid, const char * const name)
ui_current_page_off(); ui_current_page_off();
} }
void
prof_handle_roster_remove(const char * const barejid)
{
ui_roster_remove(barejid);
ui_current_page_off();
}
void void
prof_handle_disconnect(const char * const jid) prof_handle_disconnect(const char * const jid)
{ {

View File

@ -35,10 +35,7 @@ void prof_handle_idle(void);
void prof_handle_activity(void); void prof_handle_activity(void);
void prof_handle_duck_help(const char * const result); void prof_handle_duck_help(const char * const result);
void prof_handle_roster_add(const char * const barejid, const char * const name); void prof_handle_roster_add(const char * const barejid, const char * const name);
void prof_handle_roster_remove(const char * const barejid);
void prof_handle_already_in_group(const char * const contact, const char * const group); void prof_handle_already_in_group(const char * const contact, const char * const group);
void prof_handle_not_in_group(const char * const contact, const char * const group); void prof_handle_not_in_group(const char * const contact, const char * const group);
void prof_handle_group_add(const char * const contact, const char * const group);
void prof_handle_group_remove(const char * const contact, const char * const group);
#endif #endif

View File

@ -343,3 +343,26 @@ handle_room_member_nick_change(const char * const room,
ui_room_member_nick_change(room, old_nick, nick); ui_room_member_nick_change(room, old_nick, nick);
ui_current_page_off(); ui_current_page_off();
} }
void
handle_group_add(const char * const contact,
const char * const group)
{
ui_group_added(contact, group);
ui_current_page_off();
}
void
handle_group_remove(const char * const contact,
const char * const group)
{
ui_group_removed(contact, group);
ui_current_page_off();
}
void
handle_roster_remove(const char * const barejid)
{
ui_roster_remove(barejid);
ui_current_page_off();
}

View File

@ -66,5 +66,10 @@ void handle_room_member_offline(const char * const room, const char * const nick
const char * const show, const char * const status); const char * const show, const char * const status);
void handle_room_member_nick_change(const char * const room, void handle_room_member_nick_change(const char * const room,
const char * const old_nick, const char * const nick); const char * const old_nick, const char * const nick);
void handle_group_add(const char * const contact,
const char * const group);
void handle_group_remove(const char * const contact,
const char * const group);
void handle_roster_remove(const char * const barejid);
#endif #endif

View File

@ -29,6 +29,7 @@
#include "log.h" #include "log.h"
#include "profanity.h" #include "profanity.h"
#include "server_events.h"
#include "tools/autocomplete.h" #include "tools/autocomplete.h"
#include "xmpp/connection.h" #include "xmpp/connection.h"
#include "xmpp/roster.h" #include "xmpp/roster.h"
@ -149,7 +150,7 @@ _group_add_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
{ {
if (userdata != NULL) { if (userdata != NULL) {
GroupData *data = userdata; GroupData *data = userdata;
prof_handle_group_add(data->name, data->group); handle_group_add(data->name, data->group);
free(data->name); free(data->name);
free(data->group); free(data->group);
free(userdata); free(userdata);
@ -196,7 +197,7 @@ _group_remove_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
{ {
if (userdata != NULL) { if (userdata != NULL) {
GroupData *data = userdata; GroupData *data = userdata;
prof_handle_group_remove(data->name, data->group); handle_group_remove(data->name, data->group);
free(data->name); free(data->name);
free(data->group); free(data->group);
free(userdata); free(userdata);
@ -240,7 +241,7 @@ _roster_handle_push(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
roster_remove(name, barejid); roster_remove(name, barejid);
prof_handle_roster_remove(barejid); handle_roster_remove(barejid);
// otherwise update local roster // otherwise update local roster
} else { } else {