mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Tidy up /status
This commit is contained in:
parent
e506986ef5
commit
fd4d00cdd2
@ -813,13 +813,11 @@ win_show_status(const char * const contact)
|
|||||||
{
|
{
|
||||||
PContact pcontact = contact_list_get_contact(contact);
|
PContact pcontact = contact_list_get_contact(contact);
|
||||||
|
|
||||||
cons_show("");
|
|
||||||
if (pcontact != NULL) {
|
if (pcontact != NULL) {
|
||||||
_cons_show_contact(pcontact);
|
_cons_show_contact(pcontact);
|
||||||
} else {
|
} else {
|
||||||
cons_show("No such contact %s in roster.", contact);
|
cons_show("No such contact %s in roster.", contact);
|
||||||
}
|
}
|
||||||
cons_show("");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -1032,7 +1030,9 @@ cons_show_contacts(GSList *list)
|
|||||||
|
|
||||||
while(curr) {
|
while(curr) {
|
||||||
PContact contact = curr->data;
|
PContact contact = curr->data;
|
||||||
_cons_show_contact(contact);
|
if (strcmp(p_contact_subscription(contact), "none") != 0) {
|
||||||
|
_cons_show_contact(contact);
|
||||||
|
}
|
||||||
curr = g_slist_next(curr);
|
curr = g_slist_next(curr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1517,52 +1517,49 @@ _cons_show_contact(PContact contact)
|
|||||||
const char *name = p_contact_name(contact);
|
const char *name = p_contact_name(contact);
|
||||||
const char *presence = p_contact_presence(contact);
|
const char *presence = p_contact_presence(contact);
|
||||||
const char *status = p_contact_status(contact);
|
const char *status = p_contact_status(contact);
|
||||||
const char *sub = p_contact_subscription(contact);
|
|
||||||
|
|
||||||
if (strcmp(sub, "none") != 0) {
|
_win_show_time(_cons_win);
|
||||||
_win_show_time(_cons_win);
|
|
||||||
|
|
||||||
if (strcmp(presence, "online") == 0) {
|
if (strcmp(presence, "online") == 0) {
|
||||||
wattron(_cons_win, COLOUR_ONLINE);
|
wattron(_cons_win, COLOUR_ONLINE);
|
||||||
} else if (strcmp(presence, "away") == 0) {
|
} else if (strcmp(presence, "away") == 0) {
|
||||||
wattron(_cons_win, COLOUR_AWAY);
|
wattron(_cons_win, COLOUR_AWAY);
|
||||||
} else if (strcmp(presence, "chat") == 0) {
|
} else if (strcmp(presence, "chat") == 0) {
|
||||||
wattron(_cons_win, COLOUR_CHAT);
|
wattron(_cons_win, COLOUR_CHAT);
|
||||||
} else if (strcmp(presence, "dnd") == 0) {
|
} else if (strcmp(presence, "dnd") == 0) {
|
||||||
wattron(_cons_win, COLOUR_DND);
|
wattron(_cons_win, COLOUR_DND);
|
||||||
} else if (strcmp(presence, "xa") == 0) {
|
} else if (strcmp(presence, "xa") == 0) {
|
||||||
wattron(_cons_win, COLOUR_XA);
|
wattron(_cons_win, COLOUR_XA);
|
||||||
} else {
|
} else {
|
||||||
wattron(_cons_win, COLOUR_OFFLINE);
|
wattron(_cons_win, COLOUR_OFFLINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
wprintw(_cons_win, "%s", jid);
|
wprintw(_cons_win, "%s", jid);
|
||||||
|
|
||||||
if (name != NULL) {
|
if (name != NULL) {
|
||||||
wprintw(_cons_win, " (%s)", name);
|
wprintw(_cons_win, " (%s)", name);
|
||||||
}
|
}
|
||||||
|
|
||||||
wprintw(_cons_win, " is %s", presence);
|
wprintw(_cons_win, " is %s", presence);
|
||||||
|
|
||||||
if (status != NULL) {
|
if (status != NULL) {
|
||||||
wprintw(_cons_win, ", \"%s\"", p_contact_status(contact));
|
wprintw(_cons_win, ", \"%s\"", p_contact_status(contact));
|
||||||
}
|
}
|
||||||
|
|
||||||
wprintw(_cons_win, "\n");
|
wprintw(_cons_win, "\n");
|
||||||
|
|
||||||
if (strcmp(presence, "online") == 0) {
|
if (strcmp(presence, "online") == 0) {
|
||||||
wattroff(_cons_win, COLOUR_ONLINE);
|
wattroff(_cons_win, COLOUR_ONLINE);
|
||||||
} else if (strcmp(presence, "away") == 0) {
|
} else if (strcmp(presence, "away") == 0) {
|
||||||
wattroff(_cons_win, COLOUR_AWAY);
|
wattroff(_cons_win, COLOUR_AWAY);
|
||||||
} else if (strcmp(presence, "chat") == 0) {
|
} else if (strcmp(presence, "chat") == 0) {
|
||||||
wattroff(_cons_win, COLOUR_CHAT);
|
wattroff(_cons_win, COLOUR_CHAT);
|
||||||
} else if (strcmp(presence, "dnd") == 0) {
|
} else if (strcmp(presence, "dnd") == 0) {
|
||||||
wattroff(_cons_win, COLOUR_DND);
|
wattroff(_cons_win, COLOUR_DND);
|
||||||
} else if (strcmp(presence, "xa") == 0) {
|
} else if (strcmp(presence, "xa") == 0) {
|
||||||
wattroff(_cons_win, COLOUR_XA);
|
wattroff(_cons_win, COLOUR_XA);
|
||||||
} else {
|
} else {
|
||||||
wattroff(_cons_win, COLOUR_OFFLINE);
|
wattroff(_cons_win, COLOUR_OFFLINE);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user