From b762aa3a8c8a955b34ec6ce2841947d93a596ad9 Mon Sep 17 00:00:00 2001 From: Tony Olagbaiye Date: Fri, 11 May 2018 11:38:01 +0100 Subject: [PATCH] Nicklist colours --- Makefile | 4 ++-- slack-user.c | 13 +++++++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index b4d05ed..953f6ee 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ endif RM=rm -f CFLAGS+=$(DBGCFLAGS) -fno-omit-frame-pointer -fPIC -std=gnu99 -g -Wall -Wextra -Werror-implicit-function-declaration -Wno-missing-field-initializers -Ilibwebsockets/include -Ijson-c LDFLAGS+=-shared -g $(DBGCFLAGS) $(DBGLDFLAGS) -LDLIBS=-lgnutls +LDLIBS=-Wl,--push-state,--as-needed -lgnutls PREFIX ?= /usr/local LIBDIR ?= $(PREFIX)/lib @@ -73,7 +73,7 @@ distclean: clean install: slack.so ifeq ($(shell id -u),0) - $(INSTALL) -s -t $(DESTDIR)$(LIBDIR)/weechat/plugins -D -m 0755 slack.so + $(INSTALL) -s -t $(DESTDIR)$(LIBDIR)/weechat/plugins -D -m 0644 slack.so else $(INSTALL) -s -t ~/.weechat/plugins -D -m 0755 slack.so endif diff --git a/slack-user.c b/slack-user.c index 5794b7b..ff3fcd2 100644 --- a/slack-user.c +++ b/slack-user.c @@ -17,6 +17,11 @@ const char *slack_user_get_colour(struct t_slack_user *user) return weechat_info_get("nick_color", user->profile.display_name); } +const char *slack_user_get_colour_for_nicklist(struct t_slack_user *user) +{ + return weechat_info_get("nick_color_name", user->profile.display_name); +} + const char *slack_user_as_prefix(struct t_slack_workspace *workspace, struct t_slack_user *user, const char *name) @@ -83,11 +88,11 @@ void slack_user_nicklist_add(struct t_slack_workspace *workspace, "+" : "..."); weechat_nicklist_add_nick(ptr_buffer, ptr_group, user->profile.display_name, - weechat_color(user->is_away ? - "weechat.color.nicklist_away" : - "bar_fg"), + user->is_away ? + "weechat.color.nicklist_away" : + slack_user_get_colour_for_nicklist(user), user->is_away ? "+" : "", - weechat_color(""), + "bar_fg", 1); }