mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-08-01 22:26:21 +00:00
Added _rosterwin_resource()
This commit is contained in:
@@ -43,24 +43,8 @@
|
|||||||
#include "roster_list.h"
|
#include "roster_list.h"
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_rosterwin_contact(ProfLayoutSplit *layout, PContact contact)
|
_rosterwin_resource(ProfLayoutSplit *layout, PContact contact)
|
||||||
{
|
{
|
||||||
const char *name = p_contact_name_or_jid(contact);
|
|
||||||
const char *presence = p_contact_presence(contact);
|
|
||||||
char *by = prefs_get_string(PREF_ROSTER_BY);
|
|
||||||
|
|
||||||
if ((g_strcmp0(presence, "offline") != 0) || ((g_strcmp0(presence, "offline") == 0) &&
|
|
||||||
(prefs_get_boolean(PREF_ROSTER_OFFLINE)))) {
|
|
||||||
theme_item_t presence_colour = theme_main_presence_attrs(presence);
|
|
||||||
|
|
||||||
wattron(layout->subwin, theme_attrs(presence_colour));
|
|
||||||
GString *msg = g_string_new(" ");
|
|
||||||
g_string_append(msg, name);
|
|
||||||
win_printline_nowrap(layout->subwin, msg->str);
|
|
||||||
g_string_free(msg, TRUE);
|
|
||||||
wattroff(layout->subwin, theme_attrs(presence_colour));
|
|
||||||
|
|
||||||
if (prefs_get_boolean(PREF_ROSTER_RESOURCE)) {
|
|
||||||
GList *resources = p_contact_get_available_resources(contact);
|
GList *resources = p_contact_get_available_resources(contact);
|
||||||
if (resources) {
|
if (resources) {
|
||||||
GList *curr_resource = resources;
|
GList *curr_resource = resources;
|
||||||
@@ -77,6 +61,7 @@ _rosterwin_contact(ProfLayoutSplit *layout, PContact contact)
|
|||||||
wattroff(layout->subwin, theme_attrs(resource_presence_colour));
|
wattroff(layout->subwin, theme_attrs(resource_presence_colour));
|
||||||
|
|
||||||
if (prefs_get_boolean(PREF_ROSTER_PRESENCE)) {
|
if (prefs_get_boolean(PREF_ROSTER_PRESENCE)) {
|
||||||
|
char *by = prefs_get_string(PREF_ROSTER_BY);
|
||||||
gboolean by_presence = g_strcmp0(by, "presence") == 0;
|
gboolean by_presence = g_strcmp0(by, "presence") == 0;
|
||||||
gboolean has_status = resource->status != NULL;
|
gboolean has_status = resource->status != NULL;
|
||||||
gboolean show_status = prefs_get_boolean(PREF_ROSTER_STATUS);
|
gboolean show_status = prefs_get_boolean(PREF_ROSTER_STATUS);
|
||||||
@@ -104,6 +89,9 @@ _rosterwin_contact(ProfLayoutSplit *layout, PContact contact)
|
|||||||
curr_resource = g_list_next(curr_resource);
|
curr_resource = g_list_next(curr_resource);
|
||||||
}
|
}
|
||||||
} else if (prefs_get_boolean(PREF_ROSTER_PRESENCE)) {
|
} else if (prefs_get_boolean(PREF_ROSTER_PRESENCE)) {
|
||||||
|
const char *presence = p_contact_presence(contact);
|
||||||
|
theme_item_t presence_colour = theme_main_presence_attrs(presence);
|
||||||
|
char *by = prefs_get_string(PREF_ROSTER_BY);
|
||||||
gboolean by_presence = g_strcmp0(by, "presence") == 0;
|
gboolean by_presence = g_strcmp0(by, "presence") == 0;
|
||||||
gboolean has_status = p_contact_status(contact) != NULL;
|
gboolean has_status = p_contact_status(contact) != NULL;
|
||||||
gboolean show_status = prefs_get_boolean(PREF_ROSTER_STATUS);
|
gboolean show_status = prefs_get_boolean(PREF_ROSTER_STATUS);
|
||||||
@@ -129,7 +117,30 @@ _rosterwin_contact(ProfLayoutSplit *layout, PContact contact)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
g_list_free(resources);
|
g_list_free(resources);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_rosterwin_contact(ProfLayoutSplit *layout, PContact contact)
|
||||||
|
{
|
||||||
|
const char *name = p_contact_name_or_jid(contact);
|
||||||
|
const char *presence = p_contact_presence(contact);
|
||||||
|
|
||||||
|
if ((g_strcmp0(presence, "offline") != 0) || ((g_strcmp0(presence, "offline") == 0) &&
|
||||||
|
(prefs_get_boolean(PREF_ROSTER_OFFLINE)))) {
|
||||||
|
theme_item_t presence_colour = theme_main_presence_attrs(presence);
|
||||||
|
|
||||||
|
wattron(layout->subwin, theme_attrs(presence_colour));
|
||||||
|
GString *msg = g_string_new(" ");
|
||||||
|
g_string_append(msg, name);
|
||||||
|
win_printline_nowrap(layout->subwin, msg->str);
|
||||||
|
g_string_free(msg, TRUE);
|
||||||
|
wattroff(layout->subwin, theme_attrs(presence_colour));
|
||||||
|
|
||||||
|
if (prefs_get_boolean(PREF_ROSTER_RESOURCE)) {
|
||||||
|
_rosterwin_resource(layout, contact);
|
||||||
} else if (prefs_get_boolean(PREF_ROSTER_PRESENCE)) {
|
} else if (prefs_get_boolean(PREF_ROSTER_PRESENCE)) {
|
||||||
|
char *by = prefs_get_string(PREF_ROSTER_BY);
|
||||||
gboolean by_presence = g_strcmp0(by, "presence") == 0;
|
gboolean by_presence = g_strcmp0(by, "presence") == 0;
|
||||||
gboolean has_status = p_contact_status(contact) != NULL;
|
gboolean has_status = p_contact_status(contact) != NULL;
|
||||||
gboolean show_status = prefs_get_boolean(PREF_ROSTER_STATUS);
|
gboolean show_status = prefs_get_boolean(PREF_ROSTER_STATUS);
|
||||||
|
|||||||
Reference in New Issue
Block a user