Split contact add and update presence

This commit is contained in:
James Booth
2012-10-29 21:44:33 +00:00
parent dbb7445324
commit a0eda4207c
5 changed files with 79 additions and 55 deletions

View File

@@ -165,12 +165,15 @@ prof_handle_failed_login(void)
void
prof_handle_contact_online(char *contact, char *show, char *status)
{
contact_list_add(contact, NULL, show, status, NULL);
PContact result = contact_list_get_contact(contact);
if (p_contact_subscription(result) != NULL) {
if (strcmp(p_contact_subscription(result), "none") != 0) {
win_contact_online(contact, show, status);
win_page_off();
gboolean updated = contact_list_update_contact(contact, show, status);
if (updated) {
PContact result = contact_list_get_contact(contact);
if (p_contact_subscription(result) != NULL) {
if (strcmp(p_contact_subscription(result), "none") != 0) {
win_contact_online(contact, show, status);
win_page_off();
}
}
}
}
@@ -178,12 +181,15 @@ prof_handle_contact_online(char *contact, char *show, char *status)
void
prof_handle_contact_offline(char *contact, char *show, char *status)
{
contact_list_add(contact, NULL, "offline", status, NULL);
PContact result = contact_list_get_contact(contact);
if (p_contact_subscription(result) != NULL) {
if (strcmp(p_contact_subscription(result), "none") != 0) {
win_contact_offline(contact, show, status);
win_page_off();
gboolean updated = contact_list_update_contact(contact, "offline", status);
if (updated) {
PContact result = contact_list_get_contact(contact);
if (p_contact_subscription(result) != NULL) {
if (strcmp(p_contact_subscription(result), "none") != 0) {
win_contact_offline(contact, show, status);
win_page_off();
}
}
}
}