void ui_contact_offline(char *barejid, char *resource, char *status) { char *show_console = prefs_get_string(PREF_STATUSES_CONSOLE); char *show_chat_win = prefs_get_string(PREF_STATUSES_CHAT); Jid *jid = jid_create_from_bare_and_resource(barejid, resource); PContact contact = roster_get_contact(barejid); if (p_contact_subscription(contact)) { if (strcmp(p_contact_subscription(contact), "none") != 0) { // show in console if "all" if (g_strcmp0(show_console, "all") == 0) { cons_show_contact_offline(contact, resource, status); // show in console of "online" } else if (g_strcmp0(show_console, "online") == 0) { cons_show_contact_offline(contact, resource, status); } // show in chat win if "all" if (g_strcmp0(show_chat_win, "all") == 0) { ProfChatWin *chatwin = wins_get_chat(barejid); if (chatwin) { chatwin_contact_offline(chatwin, resource, status); } // show in chat win if "online" and presence online } else if (g_strcmp0(show_chat_win, "online") == 0) { ProfChatWin *chatwin = wins_get_chat(barejid); if (chatwin) { chatwin_contact_offline(chatwin, resource, status); } } } } ProfChatWin *chatwin = wins_get_chat(barejid); if (chatwin && chatwin->resource_override && (g_strcmp0(resource, chatwin->resource_override) == 0)) { FREE_SET_NULL(chatwin->resource_override); } prefs_free_string(show_console); prefs_free_string(show_chat_win); jid_destroy(jid); }
void handle_contact_offline(char *barejid, char *resource, char *status) { gboolean updated = roster_contact_offline(barejid, resource, status); if (resource != NULL && updated) { char *show_console = prefs_get_string(PREF_STATUSES_CONSOLE); char *show_chat_win = prefs_get_string(PREF_STATUSES_CHAT); Jid *jid = jid_create_from_bare_and_resource(barejid, resource); PContact contact = roster_get_contact(barejid); if (p_contact_subscription(contact) != NULL) { if (strcmp(p_contact_subscription(contact), "none") != 0) { // show in console if "all" if (g_strcmp0(show_console, "all") == 0) { cons_show_contact_offline(contact, resource, status); // show in console of "online" } else if (g_strcmp0(show_console, "online") == 0) { cons_show_contact_offline(contact, resource, status); } // show in chat win if "all" if (g_strcmp0(show_chat_win, "all") == 0) { ui_chat_win_contact_offline(contact, resource, status); // show in char win if "online" and presence online } else if (g_strcmp0(show_chat_win, "online") == 0) { ui_chat_win_contact_offline(contact, resource, status); } } } prefs_free_string(show_console); prefs_free_string(show_chat_win); jid_destroy(jid); } ui_roster(); }