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

Merge branch 'master' into readline

Conflicts:
	src/ui/inputwin.c
This commit is contained in:
James Booth 2015-02-10 20:47:22 +00:00
commit 13297a151f
4 changed files with 42 additions and 25 deletions

View File

@ -1046,12 +1046,13 @@ _who_roster(gchar **args, struct cmd_help_t help)
} else if (strcmp("available", presence) == 0) {
GSList *filtered = NULL;
while (list != NULL) {
PContact contact = list->data;
GSList *curr = list;
while (curr != NULL) {
PContact contact = curr->data;
if (p_contact_is_available(contact)) {
filtered = g_slist_append(filtered, contact);
}
list = g_slist_next(list);
curr = g_slist_next(curr);
}
if (group != NULL) {
@ -1075,12 +1076,13 @@ _who_roster(gchar **args, struct cmd_help_t help)
} else if (strcmp("unavailable", presence) == 0) {
GSList *filtered = NULL;
while (list != NULL) {
PContact contact = list->data;
GSList *curr = list;
while (curr != NULL) {
PContact contact = curr->data;
if (!p_contact_is_available(contact)) {
filtered = g_slist_append(filtered, contact);
}
list = g_slist_next(list);
curr = g_slist_next(curr);
}
if (group != NULL) {
@ -1104,12 +1106,13 @@ _who_roster(gchar **args, struct cmd_help_t help)
} else if (strcmp("online", presence) == 0) {
GSList *filtered = NULL;
while (list != NULL) {
PContact contact = list->data;
GSList *curr = list;
while (curr != NULL) {
PContact contact = curr->data;
if (p_contact_has_available_resource(contact)) {
filtered = g_slist_append(filtered, contact);
}
list = g_slist_next(list);
curr = g_slist_next(curr);
}
if (group != NULL) {
@ -1133,12 +1136,13 @@ _who_roster(gchar **args, struct cmd_help_t help)
} else if (strcmp("offline", presence) == 0) {
GSList *filtered = NULL;
while (list != NULL) {
PContact contact = list->data;
GSList *curr = list;
while (curr != NULL) {
PContact contact = curr->data;
if (!p_contact_has_available_resource(contact)) {
filtered = g_slist_append(filtered, contact);
}
list = g_slist_next(list);
curr = g_slist_next(curr);
}
if (group != NULL) {
@ -1162,12 +1166,13 @@ _who_roster(gchar **args, struct cmd_help_t help)
} else {
GSList *filtered = NULL;
while (list != NULL) {
PContact contact = list->data;
GSList *curr = list;
while (curr != NULL) {
PContact contact = curr->data;
if (strcmp(p_contact_presence(contact), presence) == 0) {
filtered = g_slist_append(filtered, contact);
}
list = g_slist_next(list);
curr = g_slist_next(curr);
}
if (group != NULL) {

View File

@ -500,25 +500,34 @@ cmp_win_num(gconstpointer a, gconstpointer b)
int
get_next_available_win_num(GList *used)
{
used = g_list_sort(used, cmp_win_num);
// only console used
if (g_list_length(used) == 1) {
return 2;
} else {
GList *sorted = NULL;
GList *curr = used;
while (curr) {
sorted = g_list_insert_sorted(sorted, curr->data, cmp_win_num);
curr = g_list_next(curr);
}
int result = 0;
int last_num = 1;
GList *curr = used;
curr = sorted;
// skip console
curr = g_list_next(curr);
while (curr != NULL) {
int curr_num = GPOINTER_TO_INT(curr->data);
if (((last_num != 9) && ((last_num + 1) != curr_num)) ||
((last_num == 9) && (curr_num != 0))) {
result = last_num + 1;
if (result == 10) {
result = 0;
}
g_list_free(sorted);
return (result);
} else {
last_num = curr_num;
if (last_num == 0) {
@ -532,6 +541,7 @@ get_next_available_win_num(GList *used)
result = 0;
}
g_list_free(sorted);
return result;
}
}

View File

@ -236,7 +236,7 @@ chat_log_init(void)
{
session_started = g_date_time_new_now_local();
log_info("Initialising chat logs");
logs = g_hash_table_new_full(g_str_hash, (GEqualFunc) _key_equals, g_free,
logs = g_hash_table_new_full(g_str_hash, (GEqualFunc) _key_equals, free,
(GDestroyNotify)_free_chat_log);
}
@ -244,7 +244,7 @@ void
groupchat_log_init(void)
{
log_info("Initialising groupchat logs");
groupchat_logs = g_hash_table_new_full(g_str_hash, (GEqualFunc) _key_equals, g_free,
groupchat_logs = g_hash_table_new_full(g_str_hash, (GEqualFunc) _key_equals, free,
(GDestroyNotify)_free_chat_log);
}
@ -396,8 +396,8 @@ chat_log_get_previous(const gchar * const login, const gchar * const recipient)
void
chat_log_close(void)
{
g_hash_table_remove_all(logs);
g_hash_table_remove_all(groupchat_logs);
g_hash_table_destroy(logs);
g_hash_table_destroy(groupchat_logs);
g_date_time_unref(session_started);
}

View File

@ -251,6 +251,7 @@ cons_show_wins(void)
win_save_println(console, curr->data);
curr = g_slist_next(curr);
}
g_slist_free_full(window_strings, free);
cons_show("");
cons_alert();
@ -402,17 +403,18 @@ cons_show_sent_subs(void)
GSList *contacts = roster_get_contacts();
PContact contact = NULL;
cons_show("Awaiting subscription responses from:");
while (contacts != NULL) {
contact = (PContact) contacts->data;
GSList *curr = contacts;
while (curr != NULL) {
contact = (PContact) curr->data;
if (p_contact_pending_out(contact)) {
cons_show(" %s", p_contact_barejid(contact));
}
contacts = g_slist_next(contacts);
curr = g_slist_next(curr);
}
g_slist_free(contacts);
} else {
cons_show("No pending requests sent.");
}
cons_alert();
}