Load roster before sending presence

This commit is contained in:
James Booth
2012-10-28 20:52:30 +00:00
parent 4b6002ae63
commit d13794bf60
10 changed files with 144 additions and 139 deletions

View File

@@ -41,7 +41,6 @@
static log_level_t _get_log_level(char *log_level);
static gboolean _process_input(char *inp);
static void _create_config_directory();
static void _free_roster_entry(jabber_roster_entry *entry);
static void _init(const int disable_tls, char *log_level);
static void _shutdown(void);
@@ -166,7 +165,7 @@ prof_handle_failed_login(void)
void
prof_handle_contact_online(char *contact, char *show, char *status)
{
gboolean result = contact_list_add(contact, show, status);
gboolean result = contact_list_add(contact, NULL, show, status, NULL);
if (result) {
win_contact_online(contact, show, status);
}
@@ -176,30 +175,13 @@ prof_handle_contact_online(char *contact, char *show, char *status)
void
prof_handle_contact_offline(char *contact, char *show, char *status)
{
gboolean result = contact_list_add(contact, "offline", status);
gboolean result = contact_list_add(contact, NULL, "offline", status, NULL);
if (result) {
win_contact_offline(contact, show, status);
}
win_page_off();
}
void
prof_handle_roster(GSList *roster)
{
while (roster != NULL) {
jabber_roster_entry *entry = roster->data;
// if contact not in contact list add them as offline
if (contact_list_find_contact(entry->jid) == NULL) {
contact_list_add(entry->jid, "offline", NULL);
}
roster = g_slist_next(roster);
}
g_slist_free_full(roster, (GDestroyNotify)_free_roster_entry);
}
static void
_create_config_directory(void)
{
@@ -209,16 +191,6 @@ _create_config_directory(void)
g_string_free(dir, TRUE);
}
static void
_free_roster_entry(jabber_roster_entry *entry)
{
if (entry->name != NULL) {
free(entry->name);
entry->name = NULL;
}
free(entry->jid);
}
static log_level_t
_get_log_level(char *log_level)
{