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

Tidied remaining chatwin functions

This commit is contained in:
James Booth 2015-10-27 23:39:26 +00:00
parent 77e854c1e8
commit 3f7f1186a6
4 changed files with 31 additions and 24 deletions

View File

@ -304,33 +304,28 @@ chatwin_outgoing_carbon(ProfChatWin *chatwin, const char *const message)
}
void
ui_chat_win_contact_online(PContact contact, Resource *resource, GDateTime *last_activity)
chatwin_contact_online(ProfChatWin *chatwin, Resource *resource, GDateTime *last_activity)
{
assert(chatwin != NULL);
const char *show = string_from_resource_presence(resource->presence);
PContact contact = roster_get_contact(chatwin->barejid);
char *display_str = p_contact_create_display_string(contact, resource->name);
const char *barejid = p_contact_barejid(contact);
ProfWin *window = (ProfWin*)wins_get_chat(barejid);
if (window) {
win_show_status_string(window, display_str, show, resource->status,
last_activity, "++", "online");
}
win_show_status_string((ProfWin*)chatwin, display_str, show, resource->status, last_activity, "++", "online");
free(display_str);
}
void
ui_chat_win_contact_offline(PContact contact, char *resource, char *status)
chatwin_contact_offline(ProfChatWin *chatwin, char *resource, char *status)
{
char *display_str = p_contact_create_display_string(contact, resource);
const char *barejid = p_contact_barejid(contact);
assert(chatwin != NULL);
ProfWin *window = (ProfWin*)wins_get_chat(barejid);
if (window) {
win_show_status_string(window, display_str, "offline", status, NULL, "--",
"offline");
}
PContact contact = roster_get_contact(chatwin->barejid);
char *display_str = p_contact_create_display_string(contact, resource);
win_show_status_string((ProfWin*)chatwin, display_str, "offline", status, NULL, "--", "offline");
free(display_str);
}

View File

@ -323,11 +323,17 @@ ui_contact_online(char *barejid, Resource *resource, GDateTime *last_activity)
// show in chat win if "all"
if (g_strcmp0(show_chat_win, "all") == 0) {
ui_chat_win_contact_online(contact, resource, last_activity);
ProfChatWin *chatwin = wins_get_chat(barejid);
if (chatwin) {
chatwin_contact_online(chatwin, resource, last_activity);
}
// show in char win if "online" and presence online
} else if (g_strcmp0(show_chat_win, "online") == 0 && resource->presence == RESOURCE_ONLINE) {
ui_chat_win_contact_online(contact, resource, last_activity);
ProfChatWin *chatwin = wins_get_chat(barejid);
if (chatwin) {
chatwin_contact_online(chatwin, resource, last_activity);
}
}
free(show_console);
@ -1790,11 +1796,17 @@ ui_contact_offline(char *barejid, char *resource, char *status)
// show in chat win if "all"
if (g_strcmp0(show_chat_win, "all") == 0) {
ui_chat_win_contact_offline(contact, resource, status);
ProfChatWin *chatwin = wins_get_chat(barejid);
if (chatwin) {
chatwin_contact_offline(chatwin, 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);
ProfChatWin *chatwin = wins_get_chat(barejid);
if (chatwin) {
chatwin_contact_offline(chatwin, resource, status);
}
}
}
}

View File

@ -168,8 +168,8 @@ void ui_contact_already_in_group(const char *const contact, const char *const gr
void ui_contact_not_in_group(const char *const contact, const char *const group);
void ui_group_added(const char *const contact, const char *const group);
void ui_group_removed(const char *const contact, const char *const group);
void ui_chat_win_contact_online(PContact contact, Resource *resource, GDateTime *last_activity);
void ui_chat_win_contact_offline(PContact contact, char *resource, char *status);
void chatwin_contact_online(ProfChatWin *chatwin, Resource *resource, GDateTime *last_activity);
void chatwin_contact_offline(ProfChatWin *chatwin, char *resource, char *status);
void ui_contact_offline(char *barejid, char *resource, char *status);
void ui_handle_recipient_not_found(const char *const recipient, const char *const err_msg);
void ui_handle_recipient_error(const char *const recipient, const char *const err_msg);

View File

@ -243,8 +243,8 @@ void ui_contact_already_in_group(const char * const contact, const char * const
void ui_contact_not_in_group(const char * const contact, const char * const group) {}
void ui_group_added(const char * const contact, const char * const group) {}
void ui_group_removed(const char * const contact, const char * const group) {}
void ui_chat_win_contact_online(PContact contact, Resource *resource, GDateTime *last_activity) {}
void ui_chat_win_contact_offline(PContact contact, char *resource, char *status) {}
void chatwin_contact_online(ProfChatWin *chatwin, Resource *resource, GDateTime *last_activity) {}
void chatwin_contact_offline(ProfChatWin *chatwin, char *resource, char *status) {}
void ui_contact_offline(char *barejid, char *resource, char *status) {}