1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Merge branch 'master' into osx-functional

This commit is contained in:
James Booth 2016-02-14 22:59:00 +00:00
commit 2006f8d6b3
120 changed files with 555 additions and 136 deletions

View File

@ -62,7 +62,7 @@ or by sending a mail directly to:
.br
.PP
.SH LICENSE
Copyright (C) 2012 \- 2015 James Booth <boothj5web@gmail.com>.
Copyright (C) 2012 \- 2016 James Booth <boothj5web@gmail.com>.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

View File

@ -1,7 +1,7 @@
/*
* chat_session.c
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* chat_session.h
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* chat_state.c
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* chat_state.h
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* command.c
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*
@ -662,7 +662,7 @@ static struct cmd_t command_defs[] =
CMD_TAG_GROUPCHAT)
CMD_SYN(
"/affiliation set <affiliation> <jid> [<reason>]",
"/list [<affiliation>]")
"/affiliation list [<affiliation>]")
CMD_DESC(
"Manage room affiliations. "
"Affiliation may be one of owner, admin, member, outcast or none.")
@ -678,7 +678,7 @@ static struct cmd_t command_defs[] =
CMD_TAG_GROUPCHAT)
CMD_SYN(
"/role set <role> <nick> [<reason>]",
"/list [<role>]")
"/role list [<role>]")
CMD_DESC(
"Manage room roles. "
"Role may be one of moderator, participant, visitor or none.")
@ -2266,6 +2266,7 @@ cmd_init(void)
autocomplete_add(roster_show_ac, "empty");
autocomplete_add(roster_show_ac, "priority");
autocomplete_add(roster_show_ac, "contacts");
autocomplete_add(roster_show_ac, "unsubscribed");
autocomplete_add(roster_show_ac, "rooms");
roster_by_ac = autocomplete_new();

View File

@ -1,7 +1,7 @@
/*
* command.h
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* commands.c
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*
@ -154,7 +154,9 @@ cmd_execute_alias(ProfWin *window, const char *const inp, gboolean *ran)
free(alias);
if (value) {
*ran = TRUE;
return cmd_process_input(window, value);
gboolean result = cmd_process_input(window, value);
prefs_free_string(value);
return result;
}
*ran = FALSE;
@ -2245,6 +2247,13 @@ cmd_roster(ProfWin *window, const char *const command, gchar **args)
rosterwin_roster();
}
return TRUE;
} else if (g_strcmp0(args[1], "unsubscribed") == 0) {
cons_show("Roster unsubscribed enabled");
prefs_set_boolean(PREF_ROSTER_UNSUBSCRIBED, TRUE);
if (conn_status == JABBER_CONNECTED) {
rosterwin_roster();
}
return TRUE;
} else {
cons_bad_cmd_usage(command);
return TRUE;
@ -2313,6 +2322,13 @@ cmd_roster(ProfWin *window, const char *const command, gchar **args)
rosterwin_roster();
}
return TRUE;
} else if (g_strcmp0(args[1], "unsubscribed") == 0) {
cons_show("Roster unsubscribed disabled");
prefs_set_boolean(PREF_ROSTER_UNSUBSCRIBED, FALSE);
if (conn_status == JABBER_CONNECTED) {
rosterwin_roster();
}
return TRUE;
} else {
cons_bad_cmd_usage(command);
return TRUE;

View File

@ -1,7 +1,7 @@
/*
* commands.h
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* common.c
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* common.h
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* account.c
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* account.h
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* accounts.c
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* accounts.h
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* conflists.c
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* conflists.h
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* preferences.c
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*
@ -139,6 +139,7 @@ prefs_load(void)
g_key_file_set_boolean(prefs, PREF_GROUP_NOTIFICATIONS, "room", FALSE);
g_key_file_set_boolean(prefs, PREF_GROUP_NOTIFICATIONS, "room.mention", TRUE);
}
prefs_free_string(value);
}
_save_prefs();
@ -277,6 +278,42 @@ prefs_do_room_notify(gboolean current_win, const char *const roomjid, const char
return FALSE;
}
gboolean
prefs_do_room_notify_mention(const char *const roomjid, int unread, gboolean mention, gboolean trigger)
{
gboolean notify_room = FALSE;
if (g_key_file_has_key(prefs, roomjid, "notify", NULL)) {
notify_room = g_key_file_get_boolean(prefs, roomjid, "notify", NULL);
} else {
notify_room = prefs_get_boolean(PREF_NOTIFY_ROOM);
}
if (notify_room && unread > 0) {
return TRUE;
}
gboolean notify_mention = FALSE;
if (g_key_file_has_key(prefs, roomjid, "notify.mention", NULL)) {
notify_mention = g_key_file_get_boolean(prefs, roomjid, "notify.mention", NULL);
} else {
notify_mention = prefs_get_boolean(PREF_NOTIFY_ROOM_MENTION);
}
if (notify_mention && mention) {
return TRUE;
}
gboolean notify_trigger = FALSE;
if (g_key_file_has_key(prefs, roomjid, "notify.trigger", NULL)) {
notify_trigger = g_key_file_get_boolean(prefs, roomjid, "notify.trigger", NULL);
} else {
notify_trigger = prefs_get_boolean(PREF_NOTIFY_ROOM_TRIGGER);
}
if (notify_trigger && trigger) {
return TRUE;
}
return FALSE;
}
void
prefs_set_room_notify(const char *const roomjid, gboolean value)
{
@ -1143,6 +1180,7 @@ _get_group(preference_t pref)
case PREF_ROSTER_WRAP:
case PREF_ROSTER_RESOURCE_JOIN:
case PREF_ROSTER_CONTACTS:
case PREF_ROSTER_UNSUBSCRIBED:
case PREF_ROSTER_ROOMS:
case PREF_ROSTER_ROOMS_POS:
case PREF_ROSTER_ROOMS_BY:
@ -1351,6 +1389,8 @@ _get_key(preference_t pref)
return "roster.resource.join";
case PREF_ROSTER_CONTACTS:
return "roster.contacts";
case PREF_ROSTER_UNSUBSCRIBED:
return "roster.unsubscribed";
case PREF_ROSTER_ROOMS:
return "roster.rooms";
case PREF_ROSTER_ROOMS_POS:
@ -1425,6 +1465,7 @@ _get_default_boolean(preference_t pref)
case PREF_ROSTER_PRIORITY:
case PREF_ROSTER_RESOURCE_JOIN:
case PREF_ROSTER_CONTACTS:
case PREF_ROSTER_UNSUBSCRIBED:
case PREF_ROSTER_ROOMS:
case PREF_TLS_SHOW:
case PREF_LASTACTIVITY:

View File

@ -1,7 +1,7 @@
/*
* preferences.h
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*
@ -76,6 +76,7 @@ typedef enum {
PREF_ROSTER_WRAP,
PREF_ROSTER_RESOURCE_JOIN,
PREF_ROSTER_CONTACTS,
PREF_ROSTER_UNSUBSCRIBED,
PREF_ROSTER_ROOMS,
PREF_ROSTER_ROOMS_POS,
PREF_ROSTER_ROOMS_BY,
@ -234,6 +235,7 @@ void prefs_set_string(preference_t pref, char *value);
gboolean prefs_do_chat_notify(gboolean current_win);
gboolean prefs_do_room_notify(gboolean current_win, const char *const roomjid, const char *const mynick,
const char *const theirnick, const char *const message, gboolean mention, gboolean trigger_found);
gboolean prefs_do_room_notify_mention(const char *const roomjid, int unread, gboolean mention, gboolean trigger);
GList* prefs_message_get_triggers(const char *const message);
void prefs_set_room_notify(const char *const roomjid, gboolean value);

View File

@ -1,7 +1,7 @@
/*
* scripts.c
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* scripts.h
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* theme.c
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*
@ -74,7 +74,7 @@ theme_init(const char *const theme_name)
}
str_to_pair = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL);
defaults = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL);
defaults = g_hash_table_new_full(g_str_hash, g_str_equal, free, free);
g_hash_table_insert(defaults, strdup("main.text"), strdup("white"));
g_hash_table_insert(defaults, strdup("main.text.me"), strdup("white"));
@ -82,6 +82,8 @@ theme_init(const char *const theme_name)
g_hash_table_insert(defaults, strdup("main.splash"), strdup("cyan"));
g_hash_table_insert(defaults, strdup("error"), strdup("red"));
g_hash_table_insert(defaults, strdup("incoming"), strdup("yellow"));
g_hash_table_insert(defaults, strdup("mention"), strdup("yellow"));
g_hash_table_insert(defaults, strdup("trigger"), strdup("yellow"));
g_hash_table_insert(defaults, strdup("input.text"), strdup("white"));
g_hash_table_insert(defaults, strdup("main.time"), strdup("white"));
g_hash_table_insert(defaults, strdup("titlebar.text"), strdup("white"));
@ -105,7 +107,9 @@ theme_init(const char *const theme_name)
g_hash_table_insert(defaults, strdup("receipt.sent"), strdup("red"));
g_hash_table_insert(defaults, strdup("roominfo"), strdup("yellow"));
g_hash_table_insert(defaults, strdup("roommention"), strdup("yellow"));
g_hash_table_insert(defaults, strdup("roommention.term"), strdup("yellow"));
g_hash_table_insert(defaults, strdup("roomtrigger"), strdup("yellow"));
g_hash_table_insert(defaults, strdup("roomtrigger.term"), strdup("yellow"));
g_hash_table_insert(defaults, strdup("online"), strdup("green"));
g_hash_table_insert(defaults, strdup("offline"), strdup("red"));
g_hash_table_insert(defaults, strdup("away"), strdup("cyan"));
@ -391,6 +395,7 @@ _load_preferences(void)
_set_boolean_preference("roster.count.zero", PREF_ROSTER_COUNT_ZERO);
_set_boolean_preference("roster.priority", PREF_ROSTER_PRIORITY);
_set_boolean_preference("roster.contacts", PREF_ROSTER_CONTACTS);
_set_boolean_preference("roster.unsubscribed", PREF_ROSTER_UNSUBSCRIBED);
_set_boolean_preference("roster.rooms", PREF_ROSTER_ROOMS);
_set_boolean_preference("privileges", PREF_MUC_PRIVILEGES);
_set_boolean_preference("presence", PREF_PRESENCE);
@ -723,6 +728,8 @@ theme_attrs(theme_item_t attrs)
case THEME_SPLASH: _theme_prep_fgnd("main.splash", lookup_str, &bold); break;
case THEME_ERROR: _theme_prep_fgnd("error", lookup_str, &bold); break;
case THEME_INCOMING: _theme_prep_fgnd("incoming", lookup_str, &bold); break;
case THEME_MENTION: _theme_prep_fgnd("mention", lookup_str, &bold); break;
case THEME_TRIGGER: _theme_prep_fgnd("trigger", lookup_str, &bold); break;
case THEME_INPUT_TEXT: _theme_prep_fgnd("input.text", lookup_str, &bold); break;
case THEME_TIME: _theme_prep_fgnd("main.time", lookup_str, &bold); break;
case THEME_TITLE_TEXT: _theme_prep_fgnd("titlebar.text", lookup_str, &bold); break;
@ -746,7 +753,9 @@ theme_attrs(theme_item_t attrs)
case THEME_RECEIPT_SENT: _theme_prep_fgnd("receipt.sent", lookup_str, &bold); break;
case THEME_ROOMINFO: _theme_prep_fgnd("roominfo", lookup_str, &bold); break;
case THEME_ROOMMENTION: _theme_prep_fgnd("roommention", lookup_str, &bold); break;
case THEME_ROOMMENTION_TERM: _theme_prep_fgnd("roommention.term", lookup_str, &bold); break;
case THEME_ROOMTRIGGER: _theme_prep_fgnd("roomtrigger", lookup_str, &bold); break;
case THEME_ROOMTRIGGER_TERM: _theme_prep_fgnd("roomtrigger.term", lookup_str, &bold); break;
case THEME_ONLINE: _theme_prep_fgnd("online", lookup_str, &bold); break;
case THEME_OFFLINE: _theme_prep_fgnd("offline", lookup_str, &bold); break;
case THEME_AWAY: _theme_prep_fgnd("away", lookup_str, &bold); break;

View File

@ -1,7 +1,7 @@
/*
* theme.h
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*
@ -46,6 +46,8 @@ typedef enum {
THEME_SPLASH,
THEME_ERROR,
THEME_INCOMING,
THEME_MENTION,
THEME_TRIGGER,
THEME_INPUT_TEXT,
THEME_TIME,
THEME_TITLE_TEXT,
@ -68,7 +70,9 @@ typedef enum {
THEME_THEM,
THEME_ROOMINFO,
THEME_ROOMMENTION,
THEME_ROOMMENTION_TERM,
THEME_ROOMTRIGGER,
THEME_ROOMTRIGGER_TERM,
THEME_ONLINE,
THEME_OFFLINE,
THEME_AWAY,

View File

@ -1,7 +1,7 @@
/*
* tlscerts.c
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* tlscerts.h
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* contact.c
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* contact.h
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* client_events.c
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* client_events.h
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* server_events.c
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*
@ -116,6 +116,7 @@ sv_ev_roster_received(void)
}
free(err_str);
}
account_free(account);
#endif
// send initial presence
@ -256,7 +257,7 @@ sv_ev_room_message(const char *const room_jid, const char *const nick, const cha
GList *triggers = prefs_message_get_triggers(message);
mucwin_message(mucwin, nick, message, mention, triggers != NULL);
mucwin_message(mucwin, nick, message, mention, triggers);
ProfWin *window = (ProfWin*)mucwin;
int num = wins_get_num(window);

View File

@ -1,7 +1,7 @@
/*
* server_events.h
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* jid.c
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* jid.h
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* log.c
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* log.h
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* main.c
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*
@ -90,7 +90,7 @@ main(int argc, char **argv)
g_print("Profanity, version %s\n", PACKAGE_VERSION);
}
g_print("Copyright (C) 2012 - 2015 James Booth <%s>.\n", PACKAGE_BUGREPORT);
g_print("Copyright (C) 2012 - 2016 James Booth <%s>.\n", PACKAGE_BUGREPORT);
g_print("License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\n");
g_print("\n");
g_print("This is free software; you are free to change and redistribute it.\n");

View File

@ -1,7 +1,7 @@
/*
* muc.c
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* muc.h
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* otr.c
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* otr.h
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* otrlib.h
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* otrlibv3.c
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* otrlibv4.c
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* gpg.c
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* gpg.h
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* profanity.c
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* profanity.h
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* resource.c
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* resource.h
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* roster_list.c
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* roster_list.h
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* autocomplete.c
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* autocomplete.h
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* parser.c
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* parser.h
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* tinyurl.c
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* tinyurl.h
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* buffer.c
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* buffer.h
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* chatwin.c
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* console.c
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*
@ -334,10 +334,10 @@ cons_show_incoming_room_message(const char *const nick, const char *const room,
if (g_strcmp0(muc_show, "all") == 0) {
if (mention) {
win_vprint(console, '-', 0, NULL, 0, THEME_INCOMING, "", "<< room mention: %s in %s (win %d)", nick, room, ui_index);
win_vprint(console, '-', 0, NULL, 0, THEME_MENTION, "", "<< room mention: %s in %s (win %d)", nick, room, ui_index);
} else if (triggers) {
char *triggers_str = _room_triggers_to_string(triggers);
win_vprint(console, '-', 0, NULL, 0, THEME_INCOMING, "", "<< room trigger %s: %s in %s (win %d)", triggers_str, nick, room, ui_index);
win_vprint(console, '-', 0, NULL, 0, THEME_TRIGGER, "", "<< room trigger %s: %s in %s (win %d)", triggers_str, nick, room, ui_index);
free(triggers_str);
} else {
win_vprint(console, '-', 0, NULL, 0, THEME_INCOMING, "", "<< room message: %s in %s (win %d)", nick, room, ui_index);
@ -346,11 +346,11 @@ cons_show_incoming_room_message(const char *const nick, const char *const room,
} else if (g_strcmp0(muc_show, "first") == 0) {
if (mention) {
win_vprint(console, '-', 0, NULL, 0, THEME_INCOMING, "", "<< room mention: %s in %s (win %d)", nick, room, ui_index);
win_vprint(console, '-', 0, NULL, 0, THEME_MENTION, "", "<< room mention: %s in %s (win %d)", nick, room, ui_index);
cons_alert();
} else if (triggers) {
char *triggers_str = _room_triggers_to_string(triggers);
win_vprint(console, '-', 0, NULL, 0, THEME_INCOMING, "", "<< room trigger %s: %s in %s (win %d)", triggers_str, nick, room, ui_index);
win_vprint(console, '-', 0, NULL, 0, THEME_TRIGGER, "", "<< room trigger %s: %s in %s (win %d)", triggers_str, nick, room, ui_index);
free(triggers_str);
cons_alert();
} else if (unread == 0) {
@ -427,7 +427,7 @@ cons_about(void)
}
}
win_vprint(console, '-', 0, NULL, 0, 0, "", "Copyright (C) 2012 - 2015 James Booth <%s>.", PACKAGE_BUGREPORT);
win_vprint(console, '-', 0, NULL, 0, 0, "", "Copyright (C) 2012 - 2016 James Booth <%s>.", PACKAGE_BUGREPORT);
win_println(console, 0, "License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>");
win_println(console, 0, "");
win_println(console, 0, "This is free software; you are free to change and redistribute it.");
@ -1410,6 +1410,11 @@ cons_roster_setting(void)
else
cons_show("Roster contacts (/roster) : hide");
if (prefs_get_boolean(PREF_ROSTER_UNSUBSCRIBED))
cons_show("Roster unsubscribed (/roster) : show");
else
cons_show("Roster unsubscribed (/roster) : hide");
char *count = prefs_get_string(PREF_ROSTER_COUNT);
if (g_strcmp0(count, "off") == 0) {
cons_show("Roster count (/roster) : OFF");
@ -2203,12 +2208,16 @@ cons_theme_properties(void)
_cons_theme_prop(THEME_UNSUBSCRIBED, "unsubscribed");
_cons_theme_prop(THEME_INCOMING, "incoming");
_cons_theme_prop(THEME_MENTION, "mention");
_cons_theme_prop(THEME_TRIGGER, "trigger");
_cons_theme_prop(THEME_TYPING, "typing");
_cons_theme_prop(THEME_GONE, "gone");
_cons_theme_prop(THEME_ROOMINFO, "roominfo");
_cons_theme_prop(THEME_ROOMMENTION, "roommention");
_cons_theme_prop(THEME_ROOMMENTION_TERM, "roommention.term");
_cons_theme_prop(THEME_ROOMTRIGGER, "roomtrigger");
_cons_theme_prop(THEME_ROOMTRIGGER_TERM, "roomtrigger.term");
_cons_theme_prop(THEME_ROSTER_HEADER, "roster.header");
_cons_theme_prop(THEME_ROSTER_CHAT, "roster.chat");

View File

@ -1,7 +1,7 @@
/*
* core.c
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* inputwin.c
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* inputwin.c
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* mucconfwin.c
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* mucwin.c
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*
@ -355,9 +355,121 @@ mucwin_history(ProfMucWin *mucwin, const char *const nick, GDateTime *timestamp,
g_string_free(line, TRUE);
}
static void
_mucwin_print_mention(ProfWin *window, const char *const message, const char *const my_nick)
{
char *mynick_lower = g_utf8_strdown(my_nick, -1);
char *message_lower = g_utf8_strdown(message, -1);
char message_section[strlen(message) + 1];
int i = 0;
while(!g_str_has_prefix(&message_lower[i], mynick_lower) && i < strlen(message)) {
message_section[i] = message[i];
i++;
}
message_section[i] = '\0';
char *mention_section = strndup(&message[i], strlen(my_nick));
int used = strlen(message_section) + strlen(mention_section);
win_print(window, '-', 0, NULL, NO_DATE | NO_ME | NO_EOL, THEME_ROOMMENTION, "", message_section);
if (strlen(message) > used) {
win_print(window, '-', 0, NULL, NO_DATE | NO_ME | NO_EOL, THEME_ROOMMENTION_TERM, "", mention_section);
_mucwin_print_mention(window, &message[used], my_nick);
} else {
win_print(window, '-', 0, NULL, NO_DATE | NO_ME, THEME_ROOMMENTION_TERM, "", mention_section);
}
free(mention_section);
g_free(mynick_lower);
g_free(message_lower);
}
gint
_cmp_trigger_weight(gconstpointer a, gconstpointer b)
{
int alen = strlen((char*)a);
int blen = strlen((char*)b);
if (alen > blen) return -1;
if (alen < blen) return 1;
return 0;
}
static void
_mucwin_print_triggers(ProfWin *window, const char *const message, GList *triggers)
{
GList *weighted_triggers = NULL;
GList *curr = triggers;
while (curr) {
weighted_triggers = g_list_insert_sorted(weighted_triggers, curr->data, (GCompareFunc)_cmp_trigger_weight);
curr = g_list_next(curr);
}
char *message_lower = g_utf8_strdown(message, -1);
// find earliest trigger in message
int first_trigger_pos = -1;
int first_trigger_len = -1;
curr = weighted_triggers;
while (curr) {
char *trigger_lower = g_utf8_strdown(curr->data, -1);
char *trigger_ptr = g_strstr_len(message_lower, -1, trigger_lower);
// not found, try next
if (trigger_ptr == NULL) {
curr = g_list_next(curr);
continue;
}
// found, repace vars if earlier than previous
int trigger_pos = trigger_ptr - message_lower;
if (first_trigger_pos == -1 || trigger_pos < first_trigger_pos) {
first_trigger_pos = trigger_pos;
first_trigger_len = strlen(trigger_lower);
}
g_free(trigger_lower);
curr = g_list_next(curr);
}
g_free(message_lower);
g_list_free(weighted_triggers);
// no triggers found
if (first_trigger_pos == -1) {
win_print(window, '-', 0, NULL, NO_DATE | NO_ME, THEME_ROOMTRIGGER, "", message);
} else {
if (first_trigger_pos > 0) {
char message_section[strlen(message) + 1];
int i = 0;
while (i < first_trigger_pos) {
message_section[i] = message[i];
i++;
}
message_section[i] = '\0';
win_print(window, '-', 0, NULL, NO_DATE | NO_ME | NO_EOL, THEME_ROOMTRIGGER, "", message_section);
}
char trigger_section[first_trigger_len + 1];
int i = 0;
while (i < first_trigger_len) {
trigger_section[i] = message[first_trigger_pos + i];
i++;
}
trigger_section[i] = '\0';
if (first_trigger_pos + first_trigger_len < strlen(message)) {
win_print(window, '-', 0, NULL, NO_DATE | NO_ME | NO_EOL, THEME_ROOMTRIGGER_TERM, "", trigger_section);
_mucwin_print_triggers(window, &message[first_trigger_pos + first_trigger_len], triggers);
} else {
win_print(window, '-', 0, NULL, NO_DATE | NO_ME, THEME_ROOMTRIGGER_TERM, "", trigger_section);
}
}
}
void
mucwin_message(ProfMucWin *mucwin, const char *const nick, const char *const message, gboolean mention,
gboolean trigger_found)
mucwin_message(ProfMucWin *mucwin, const char *const nick, const char *const message, gboolean mention, GList *triggers)
{
assert(mucwin != NULL);
@ -366,9 +478,11 @@ mucwin_message(ProfMucWin *mucwin, const char *const nick, const char *const mes
if (g_strcmp0(nick, my_nick) != 0) {
if (mention) {
win_print(window, '-', 0, NULL, NO_ME, THEME_ROOMMENTION, nick, message);
} else if (trigger_found) {
win_print(window, '-', 0, NULL, NO_ME, THEME_ROOMTRIGGER, nick, message);
win_print(window, '-', 0, NULL, NO_ME | NO_EOL, THEME_ROOMMENTION, nick, "");
_mucwin_print_mention(window, message, my_nick);
} else if (triggers) {
win_print(window, '-', 0, NULL, NO_ME | NO_EOL, THEME_ROOMTRIGGER, nick, "");
_mucwin_print_triggers(window, message, triggers);
} else {
win_print(window, '-', 0, NULL, NO_ME, THEME_TEXT_THEM, nick, message);
}

View File

@ -1,7 +1,7 @@
/*
* notifier.c
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* occupantswin.c
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* privwin.c
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* rosterwin.c
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*
@ -53,9 +53,12 @@ static void _rosterwin_contacts_all(ProfLayoutSplit *layout, gboolean newline);
static void _rosterwin_contacts_by_presence(ProfLayoutSplit *layout, const char *const presence, char *title,
gboolean newline);
static void _rosterwin_contacts_by_group(ProfLayoutSplit *layout, char *group, gboolean newline);
static void _rosteriwin_unsubscribed(ProfLayoutSplit *layout, gboolean newline);
static void _rosterwin_contacts_header(ProfLayoutSplit *layout, const char *title, gboolean newline, GSList *contacts);
static void _rosterwin_unsubscribed_header(ProfLayoutSplit *layout, gboolean newline, GList *wins);
static void _rosterwin_contact(ProfLayoutSplit *layout, PContact contact);
static void _rosterwin_unsubscribed_item(ProfLayoutSplit *layout, ProfChatWin *chatwin);
static void _rosterwin_presence(ProfLayoutSplit *layout, const char *presence, const char *status,
int current_indent);
static void _rosterwin_resources(ProfLayoutSplit *layout, PContact contact, int current_indent,
@ -149,6 +152,10 @@ rosterwin_roster(void)
} else {
_rosterwin_contacts_all(layout, newline);
}
if (prefs_get_boolean(PREF_ROSTER_UNSUBSCRIBED)) {
_rosteriwin_unsubscribed(layout, newline);
}
prefs_free_string(by);
}
@ -215,6 +222,24 @@ _rosterwin_contacts_all(ProfLayoutSplit *layout, gboolean newline)
g_slist_free(filtered_contacts);
}
static void
_rosteriwin_unsubscribed(ProfLayoutSplit *layout, gboolean newline)
{
GList *wins = wins_get_chat_unsubscribed();
if (wins) {
_rosterwin_unsubscribed_header(layout, newline, wins);
}
GList *curr = wins;
while (curr) {
ProfChatWin *chatwin = curr->data;
_rosterwin_unsubscribed_item(layout, chatwin);
curr = g_list_next(curr);
}
g_list_free(wins);
}
static void
_rosterwin_contacts_by_presence(ProfLayoutSplit *layout, const char *const presence, char *title, gboolean newline)
{
@ -271,6 +296,58 @@ _rosterwin_contacts_by_group(ProfLayoutSplit *layout, char *group, gboolean newl
g_slist_free(filtered_contacts);
}
static void
_rosterwin_unsubscribed_item(ProfLayoutSplit *layout, ProfChatWin *chatwin)
{
const char *const name = chatwin->barejid;
const char *const presence = "offline";
int unread = 0;
roster_contact_theme_t theme_type = ROSTER_CONTACT;
if (chatwin->unread > 0) {
theme_type = ROSTER_CONTACT_UNREAD;
unread = chatwin->unread;
} else {
theme_type = ROSTER_CONTACT_ACTIVE;
}
theme_item_t presence_colour = _get_roster_theme(theme_type, presence);
wattron(layout->subwin, theme_attrs(presence_colour));
GString *msg = g_string_new(" ");
int indent = prefs_get_roster_contact_indent();
int current_indent = 0;
if (indent > 0) {
current_indent += indent;
while (indent > 0) {
g_string_append(msg, " ");
indent--;
}
}
char ch = prefs_get_roster_contact_char();
if (ch) {
g_string_append_printf(msg, "%c", ch);
}
char *unreadpos = prefs_get_string(PREF_ROSTER_UNREAD);
if ((g_strcmp0(unreadpos, "before") == 0) && unread > 0) {
g_string_append_printf(msg, "(%d) ", unread);
unread = 0;
}
g_string_append(msg, name);
if ((g_strcmp0(unreadpos, "after") == 0) && unread > 0) {
g_string_append_printf(msg, " (%d)", unread);
unread = 0;
}
prefs_free_string(unreadpos);
win_sub_newline_lazy(layout->subwin);
gboolean wrap = prefs_get_boolean(PREF_ROSTER_WRAP);
win_sub_print(layout->subwin, msg->str, FALSE, wrap, current_indent);
g_string_free(msg, TRUE);
wattroff(layout->subwin, theme_attrs(presence_colour));
}
static void
_rosterwin_contact(ProfLayoutSplit *layout, PContact contact)
{
@ -682,6 +759,7 @@ _rosterwin_room(ProfLayoutSplit *layout, ProfMucWin *mucwin)
} else {
g_string_append(msg, mucwin->roomjid);
}
prefs_free_string(roombypref);
if ((g_strcmp0(unreadpos, "after") == 0) && mucwin->unread > 0) {
g_string_append_printf(msg, " (%d)", mucwin->unread);
}
@ -888,6 +966,54 @@ _compare_rooms_unread(ProfMucWin *a, ProfMucWin *b)
}
}
static void
_rosterwin_unsubscribed_header(ProfLayoutSplit *layout, gboolean newline, GList *wins)
{
if (newline) {
win_sub_newline_lazy(layout->subwin);
}
GString *header = g_string_new(" ");
char ch = prefs_get_roster_header_char();
if (ch) {
g_string_append_printf(header, "%c", ch);
}
g_string_append(header, "Unsubscribed");
char *countpref = prefs_get_string(PREF_ROSTER_COUNT);
if (g_strcmp0(countpref, "items") == 0) {
int itemcount = g_list_length(wins);
if (itemcount == 0 && prefs_get_boolean(PREF_ROSTER_COUNT_ZERO)) {
g_string_append_printf(header, " (%d)", itemcount);
} else {
g_string_append_printf(header, " (%d)", itemcount);
}
} else if (g_strcmp0(countpref, "unread") == 0) {
int unreadcount = 0;
GList *curr = wins;
while (curr) {
ProfChatWin *chatwin = curr->data;
unreadcount += chatwin->unread;
curr = g_list_next(curr);
}
if (unreadcount == 0 && prefs_get_boolean(PREF_ROSTER_COUNT_ZERO)) {
g_string_append_printf(header, " (%d)", unreadcount);
} else if (unreadcount > 0) {
g_string_append_printf(header, " (%d)", unreadcount);
}
}
prefs_free_string(countpref);
gboolean wrap = prefs_get_boolean(PREF_ROSTER_WRAP);
wattron(layout->subwin, theme_attrs(THEME_ROSTER_HEADER));
win_sub_print(layout->subwin, header->str, FALSE, wrap, 1);
wattroff(layout->subwin, theme_attrs(THEME_ROSTER_HEADER));
g_string_free(header, TRUE);
}
static void
_rosterwin_contacts_header(ProfLayoutSplit *layout, const char *const title, gboolean newline, GSList *contacts)
{

View File

@ -1,7 +1,7 @@
/*
* statusbar.c
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* statusbar.h
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* titlebar.c
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* titlebar.h
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* ui.h
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*
@ -158,7 +158,7 @@ void mucwin_occupant_role_and_affiliation_change(ProfMucWin *mucwin, const char
const char *const role, const char *const affiliation, const char *const actor, const char *const reason);
void mucwin_roster(ProfMucWin *mucwin, GList *occupants, const char *const presence);
void mucwin_history(ProfMucWin *mucwin, const char *const nick, GDateTime *timestamp, const char *const message);
void mucwin_message(ProfMucWin *mucwin, const char *const nick, const char *const message, gboolean mention, gboolean trigger_found);
void mucwin_message(ProfMucWin *mucwin, const char *const nick, const char *const message, gboolean mention, GList *triggers);
void mucwin_subject(ProfMucWin *mucwin, const char *const nick, const char *const subject);
void mucwin_requires_config(ProfMucWin *mucwin);
void mucwin_info(ProfMucWin *mucwin);
@ -345,7 +345,7 @@ ProfWin* win_create_muc_config(const char *const title, DataForm *form);
ProfWin* win_create_private(const char *const fulljid);
void win_update_virtual(ProfWin *window);
void win_free(ProfWin *window);
gboolean win_notify(ProfWin *window);
gboolean win_notify_remind(ProfWin *window);
int win_unread(ProfWin *window);
void win_resize(ProfWin *window);
void win_hide_subwin(ProfWin *window);

View File

@ -1,7 +1,7 @@
/*
* win_types.h
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* window.c
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*
@ -1308,7 +1308,7 @@ win_has_active_subwin(ProfWin *window)
}
gboolean
win_notify(ProfWin *window)
win_notify_remind(ProfWin *window)
{
switch (window->type) {
case WIN_CHAT:
@ -1327,15 +1327,7 @@ win_notify(ProfWin *window)
ProfMucWin *mucwin = (ProfMucWin*) window;
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
if (prefs_get_room_notify(mucwin->roomjid) && mucwin->unread > 0) {
return TRUE;
} else if (prefs_get_room_notify_mention(mucwin->roomjid) && mucwin->unread_mentions) {
return TRUE;
} else if (prefs_get_room_notify_trigger(mucwin->roomjid) && mucwin->unread_triggers) {
return TRUE;
} else {
return FALSE;
}
return prefs_do_room_notify_mention(mucwin->roomjid, mucwin->unread, mucwin->unread_mentions, mucwin->unread_triggers);
}
case WIN_PRIVATE:
{

View File

@ -1,7 +1,7 @@
/*
* window.h
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* xmlwin.c
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* window_list.c
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*
@ -106,6 +106,35 @@ wins_get_chat(const char *const barejid)
return NULL;
}
static gint
_cmp_unsubscribed_wins(ProfChatWin *a, ProfChatWin *b)
{
return g_strcmp0(a->barejid, b->barejid);
}
GList*
wins_get_chat_unsubscribed(void)
{
GList *result = NULL;
GList *values = g_hash_table_get_values(windows);
GList *curr = values;
while (curr) {
ProfWin *window = curr->data;
if (window->type == WIN_CHAT) {
ProfChatWin *chatwin = (ProfChatWin*)window;
PContact contact = roster_get_contact(chatwin->barejid);
if (contact == NULL) {
result = g_list_insert_sorted(result, chatwin, (GCompareFunc)_cmp_unsubscribed_wins);
}
}
curr = g_list_next(curr);
}
g_list_free(values);
return result;
}
ProfMucConfWin*
wins_get_muc_conf(const char *const roomjid)
{
@ -593,12 +622,13 @@ wins_do_notify_remind(void)
while (curr) {
ProfWin *window = curr->data;
if (win_notify(window)) {
if (win_notify_remind(window)) {
g_list_free(values);
return TRUE;
}
curr = g_list_next(curr);
}
g_list_free(values);
return FALSE;
}

View File

@ -1,7 +1,7 @@
/*
* window_list.h
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*
@ -53,6 +53,7 @@ void wins_remove_nick(const char *const barejid, const char *const oldnick);
ProfWin* wins_get_console(void);
ProfChatWin* wins_get_chat(const char *const barejid);
GList* wins_get_chat_unsubscribed(void);
ProfMucWin* wins_get_muc(const char *const roomjid);
ProfMucConfWin* wins_get_muc_conf(const char *const roomjid);
ProfPrivateWin* wins_get_private(const char *const fulljid);

View File

@ -1,7 +1,7 @@
/*
* bookmark.c
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* bookmark.h
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* capabilities.c
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* capabilities.h
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* connection.c
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* connection.h
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* form.c
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* form.h
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* iq.c
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* iq.h
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* message.c
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* message.h
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* presence.c
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* presence.h
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* roster.c
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* roster.h
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* stanza.c
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* stanza.h
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

View File

@ -1,7 +1,7 @@
/*
* xmpp.h
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*

Some files were not shown because too many files have changed in this diff Show More