mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Merge branch 'master' into readline
This commit is contained in:
commit
64774a947e
@ -1069,6 +1069,7 @@ _who_roster(gchar **args, struct cmd_help_t help)
|
|||||||
cons_show_contacts(filtered);
|
cons_show_contacts(filtered);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
g_slist_free(filtered);
|
||||||
|
|
||||||
// unavailable
|
// unavailable
|
||||||
} else if (strcmp("unavailable", presence) == 0) {
|
} else if (strcmp("unavailable", presence) == 0) {
|
||||||
@ -1097,6 +1098,7 @@ _who_roster(gchar **args, struct cmd_help_t help)
|
|||||||
cons_show_contacts(filtered);
|
cons_show_contacts(filtered);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
g_slist_free(filtered);
|
||||||
|
|
||||||
// online, available resources
|
// online, available resources
|
||||||
} else if (strcmp("online", presence) == 0) {
|
} else if (strcmp("online", presence) == 0) {
|
||||||
@ -1125,6 +1127,7 @@ _who_roster(gchar **args, struct cmd_help_t help)
|
|||||||
cons_show_contacts(filtered);
|
cons_show_contacts(filtered);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
g_slist_free(filtered);
|
||||||
|
|
||||||
// offline, no available resources
|
// offline, no available resources
|
||||||
} else if (strcmp("offline", presence) == 0) {
|
} else if (strcmp("offline", presence) == 0) {
|
||||||
@ -1153,6 +1156,7 @@ _who_roster(gchar **args, struct cmd_help_t help)
|
|||||||
cons_show_contacts(filtered);
|
cons_show_contacts(filtered);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
g_slist_free(filtered);
|
||||||
|
|
||||||
// show specific status
|
// show specific status
|
||||||
} else {
|
} else {
|
||||||
@ -1181,6 +1185,7 @@ _who_roster(gchar **args, struct cmd_help_t help)
|
|||||||
cons_show_contacts(filtered);
|
cons_show_contacts(filtered);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
g_slist_free(filtered);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_slist_free(list);
|
g_slist_free(list);
|
||||||
|
@ -682,8 +682,6 @@ win_show_info(ProfWin *window, PContact contact)
|
|||||||
const char *name = p_contact_name(contact);
|
const char *name = p_contact_name(contact);
|
||||||
const char *presence = p_contact_presence(contact);
|
const char *presence = p_contact_presence(contact);
|
||||||
const char *sub = p_contact_subscription(contact);
|
const char *sub = p_contact_subscription(contact);
|
||||||
GList *resources = p_contact_get_available_resources(contact);
|
|
||||||
GList *ordered_resources = NULL;
|
|
||||||
GDateTime *last_activity = p_contact_last_activity(contact);
|
GDateTime *last_activity = p_contact_last_activity(contact);
|
||||||
|
|
||||||
theme_item_t presence_colour = theme_main_presence_attrs(presence);
|
theme_item_t presence_colour = theme_main_presence_attrs(presence);
|
||||||
@ -719,20 +717,25 @@ win_show_info(ProfWin *window, PContact contact)
|
|||||||
g_date_time_unref(now);
|
g_date_time_unref(now);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GList *resources = p_contact_get_available_resources(contact);
|
||||||
|
GList *ordered_resources = NULL;
|
||||||
if (resources != NULL) {
|
if (resources != NULL) {
|
||||||
win_save_print(window, '-', NULL, 0, 0, "", "Resources:");
|
win_save_print(window, '-', NULL, 0, 0, "", "Resources:");
|
||||||
|
|
||||||
// sort in order of availabiltiy
|
// sort in order of availabiltiy
|
||||||
while (resources != NULL) {
|
GList *curr = resources;
|
||||||
Resource *resource = resources->data;
|
while (curr != NULL) {
|
||||||
|
Resource *resource = curr->data;
|
||||||
ordered_resources = g_list_insert_sorted(ordered_resources,
|
ordered_resources = g_list_insert_sorted(ordered_resources,
|
||||||
resource, (GCompareFunc)resource_compare_availability);
|
resource, (GCompareFunc)resource_compare_availability);
|
||||||
resources = g_list_next(resources);
|
curr = g_list_next(curr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
g_list_free(resources);
|
||||||
|
|
||||||
while (ordered_resources != NULL) {
|
GList *curr = ordered_resources;
|
||||||
Resource *resource = ordered_resources->data;
|
while (curr != NULL) {
|
||||||
|
Resource *resource = curr->data;
|
||||||
const char *resource_presence = string_from_resource_presence(resource->presence);
|
const char *resource_presence = string_from_resource_presence(resource->presence);
|
||||||
theme_item_t presence_colour = theme_main_presence_attrs(resource_presence);
|
theme_item_t presence_colour = theme_main_presence_attrs(resource_presence);
|
||||||
win_save_vprint(window, '-', NULL, NO_EOL, presence_colour, "", " %s (%d), %s", resource->name, resource->priority, resource_presence);
|
win_save_vprint(window, '-', NULL, NO_EOL, presence_colour, "", " %s (%d), %s", resource->name, resource->priority, resource_presence);
|
||||||
@ -787,8 +790,9 @@ win_show_info(ProfWin *window, PContact contact)
|
|||||||
caps_destroy(caps);
|
caps_destroy(caps);
|
||||||
}
|
}
|
||||||
|
|
||||||
ordered_resources = g_list_next(ordered_resources);
|
curr = g_list_next(curr);
|
||||||
}
|
}
|
||||||
|
g_list_free(ordered_resources);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -132,6 +132,7 @@ wins_get_muc(const char * const roomjid)
|
|||||||
if (window->type == WIN_MUC) {
|
if (window->type == WIN_MUC) {
|
||||||
ProfMucWin *mucwin = (ProfMucWin*)window;
|
ProfMucWin *mucwin = (ProfMucWin*)window;
|
||||||
if (g_strcmp0(mucwin->roomjid, roomjid) == 0) {
|
if (g_strcmp0(mucwin->roomjid, roomjid) == 0) {
|
||||||
|
g_list_free(values);
|
||||||
return mucwin;
|
return mucwin;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -153,6 +154,7 @@ wins_get_private(const char * const fulljid)
|
|||||||
if (window->type == WIN_PRIVATE) {
|
if (window->type == WIN_PRIVATE) {
|
||||||
ProfPrivateWin *privatewin = (ProfPrivateWin*)window;
|
ProfPrivateWin *privatewin = (ProfPrivateWin*)window;
|
||||||
if (g_strcmp0(privatewin->fulljid, fulljid) == 0) {
|
if (g_strcmp0(privatewin->fulljid, fulljid) == 0) {
|
||||||
|
g_list_free(values);
|
||||||
return privatewin;
|
return privatewin;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -408,9 +410,9 @@ wins_new_xmlconsole(void)
|
|||||||
{
|
{
|
||||||
GList *keys = g_hash_table_get_keys(windows);
|
GList *keys = g_hash_table_get_keys(windows);
|
||||||
int result = get_next_available_win_num(keys);
|
int result = get_next_available_win_num(keys);
|
||||||
|
g_list_free(keys);
|
||||||
ProfWin *newwin = win_create_xmlconsole();
|
ProfWin *newwin = win_create_xmlconsole();
|
||||||
g_hash_table_insert(windows, GINT_TO_POINTER(result), newwin);
|
g_hash_table_insert(windows, GINT_TO_POINTER(result), newwin);
|
||||||
g_list_free(keys);
|
|
||||||
return newwin;
|
return newwin;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -419,9 +421,9 @@ wins_new_chat(const char * const barejid)
|
|||||||
{
|
{
|
||||||
GList *keys = g_hash_table_get_keys(windows);
|
GList *keys = g_hash_table_get_keys(windows);
|
||||||
int result = get_next_available_win_num(keys);
|
int result = get_next_available_win_num(keys);
|
||||||
|
g_list_free(keys);
|
||||||
ProfWin *newwin = win_create_chat(barejid);
|
ProfWin *newwin = win_create_chat(barejid);
|
||||||
g_hash_table_insert(windows, GINT_TO_POINTER(result), newwin);
|
g_hash_table_insert(windows, GINT_TO_POINTER(result), newwin);
|
||||||
g_list_free(keys);
|
|
||||||
return newwin;
|
return newwin;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -430,9 +432,9 @@ wins_new_muc(const char * const roomjid)
|
|||||||
{
|
{
|
||||||
GList *keys = g_hash_table_get_keys(windows);
|
GList *keys = g_hash_table_get_keys(windows);
|
||||||
int result = get_next_available_win_num(keys);
|
int result = get_next_available_win_num(keys);
|
||||||
|
g_list_free(keys);
|
||||||
ProfWin *newwin = win_create_muc(roomjid);
|
ProfWin *newwin = win_create_muc(roomjid);
|
||||||
g_hash_table_insert(windows, GINT_TO_POINTER(result), newwin);
|
g_hash_table_insert(windows, GINT_TO_POINTER(result), newwin);
|
||||||
g_list_free(keys);
|
|
||||||
return newwin;
|
return newwin;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -441,9 +443,9 @@ wins_new_muc_config(const char * const roomjid, DataForm *form)
|
|||||||
{
|
{
|
||||||
GList *keys = g_hash_table_get_keys(windows);
|
GList *keys = g_hash_table_get_keys(windows);
|
||||||
int result = get_next_available_win_num(keys);
|
int result = get_next_available_win_num(keys);
|
||||||
|
g_list_free(keys);
|
||||||
ProfWin *newwin = win_create_muc_config(roomjid, form);
|
ProfWin *newwin = win_create_muc_config(roomjid, form);
|
||||||
g_hash_table_insert(windows, GINT_TO_POINTER(result), newwin);
|
g_hash_table_insert(windows, GINT_TO_POINTER(result), newwin);
|
||||||
g_list_free(keys);
|
|
||||||
return newwin;
|
return newwin;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -452,9 +454,9 @@ wins_new_private(const char * const fulljid)
|
|||||||
{
|
{
|
||||||
GList *keys = g_hash_table_get_keys(windows);
|
GList *keys = g_hash_table_get_keys(windows);
|
||||||
int result = get_next_available_win_num(keys);
|
int result = get_next_available_win_num(keys);
|
||||||
|
g_list_free(keys);
|
||||||
ProfWin *newwin = win_create_private(fulljid);
|
ProfWin *newwin = win_create_private(fulljid);
|
||||||
g_hash_table_insert(windows, GINT_TO_POINTER(result), newwin);
|
g_hash_table_insert(windows, GINT_TO_POINTER(result), newwin);
|
||||||
g_list_free(keys);
|
|
||||||
return newwin;
|
return newwin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,49 +154,49 @@ _caps_by_ver(const char * const ver)
|
|||||||
|
|
||||||
char *category = g_key_file_get_string(cache, ver, "category", NULL);
|
char *category = g_key_file_get_string(cache, ver, "category", NULL);
|
||||||
if (category) {
|
if (category) {
|
||||||
new_caps->category = strdup(category);
|
new_caps->category = category;
|
||||||
} else {
|
} else {
|
||||||
new_caps->category = NULL;
|
new_caps->category = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *type = g_key_file_get_string(cache, ver, "type", NULL);
|
char *type = g_key_file_get_string(cache, ver, "type", NULL);
|
||||||
if (type) {
|
if (type) {
|
||||||
new_caps->type = strdup(type);
|
new_caps->type = type;
|
||||||
} else {
|
} else {
|
||||||
new_caps->type = NULL;
|
new_caps->type = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *name = g_key_file_get_string(cache, ver, "name", NULL);
|
char *name = g_key_file_get_string(cache, ver, "name", NULL);
|
||||||
if (name) {
|
if (name) {
|
||||||
new_caps->name = strdup(name);
|
new_caps->name = name;
|
||||||
} else {
|
} else {
|
||||||
new_caps->name = NULL;
|
new_caps->name = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *software = g_key_file_get_string(cache, ver, "software", NULL);
|
char *software = g_key_file_get_string(cache, ver, "software", NULL);
|
||||||
if (software) {
|
if (software) {
|
||||||
new_caps->software = strdup(software);
|
new_caps->software = software;
|
||||||
} else {
|
} else {
|
||||||
new_caps->software = NULL;
|
new_caps->software = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *software_version = g_key_file_get_string(cache, ver, "software_version", NULL);
|
char *software_version = g_key_file_get_string(cache, ver, "software_version", NULL);
|
||||||
if (software_version) {
|
if (software_version) {
|
||||||
new_caps->software_version = strdup(software_version);
|
new_caps->software_version = software_version;
|
||||||
} else {
|
} else {
|
||||||
new_caps->software_version = NULL;
|
new_caps->software_version = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *os = g_key_file_get_string(cache, ver, "os", NULL);
|
char *os = g_key_file_get_string(cache, ver, "os", NULL);
|
||||||
if (os) {
|
if (os) {
|
||||||
new_caps->os = strdup(os);
|
new_caps->os = os;
|
||||||
} else {
|
} else {
|
||||||
new_caps->os = NULL;
|
new_caps->os = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *os_version = g_key_file_get_string(cache, ver, "os_version", NULL);
|
char *os_version = g_key_file_get_string(cache, ver, "os_version", NULL);
|
||||||
if (os_version) {
|
if (os_version) {
|
||||||
new_caps->os_version = strdup(os_version);
|
new_caps->os_version = os_version;
|
||||||
} else {
|
} else {
|
||||||
new_caps->os_version = NULL;
|
new_caps->os_version = NULL;
|
||||||
}
|
}
|
||||||
|
@ -631,6 +631,8 @@ _caps_response_handler_for_jid(xmpp_conn_t *const conn, xmpp_stanza_t * const st
|
|||||||
Capabilities *capabilities = caps_create(query);
|
Capabilities *capabilities = caps_create(query);
|
||||||
caps_add_by_jid(jid, capabilities);
|
caps_add_by_jid(jid, capabilities);
|
||||||
|
|
||||||
|
free(jid);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -640,10 +642,12 @@ _caps_response_handler_legacy(xmpp_conn_t *const conn, xmpp_stanza_t * const sta
|
|||||||
{
|
{
|
||||||
const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID);
|
const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID);
|
||||||
xmpp_stanza_t *query = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_QUERY);
|
xmpp_stanza_t *query = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_QUERY);
|
||||||
|
char *expected_node = (char *)userdata;
|
||||||
|
|
||||||
char *type = xmpp_stanza_get_type(stanza);
|
char *type = xmpp_stanza_get_type(stanza);
|
||||||
// ignore non result
|
// ignore non result
|
||||||
if ((g_strcmp0(type, "get") == 0) || (g_strcmp0(type, "set") == 0)) {
|
if ((g_strcmp0(type, "get") == 0) || (g_strcmp0(type, "set") == 0)) {
|
||||||
|
free(expected_node);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -656,6 +660,7 @@ _caps_response_handler_legacy(xmpp_conn_t *const conn, xmpp_stanza_t * const sta
|
|||||||
const char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
|
const char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
|
||||||
if (!from) {
|
if (!from) {
|
||||||
log_info("No from attribute");
|
log_info("No from attribute");
|
||||||
|
free(expected_node);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -664,22 +669,23 @@ _caps_response_handler_legacy(xmpp_conn_t *const conn, xmpp_stanza_t * const sta
|
|||||||
char *error_message = stanza_get_error_message(stanza);
|
char *error_message = stanza_get_error_message(stanza);
|
||||||
log_warning("Error received for capabilities response from %s: ", from, error_message);
|
log_warning("Error received for capabilities response from %s: ", from, error_message);
|
||||||
free(error_message);
|
free(error_message);
|
||||||
|
free(expected_node);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (query == NULL) {
|
if (query == NULL) {
|
||||||
log_warning("No query element found.");
|
log_warning("No query element found.");
|
||||||
|
free(expected_node);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *node = xmpp_stanza_get_attribute(query, STANZA_ATTR_NODE);
|
char *node = xmpp_stanza_get_attribute(query, STANZA_ATTR_NODE);
|
||||||
if (node == NULL) {
|
if (node == NULL) {
|
||||||
log_warning("No node attribute found");
|
log_warning("No node attribute found");
|
||||||
|
free(expected_node);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *expected_node = (char *)userdata;
|
|
||||||
|
|
||||||
// nodes match
|
// nodes match
|
||||||
if (g_strcmp0(expected_node, node) == 0) {
|
if (g_strcmp0(expected_node, node) == 0) {
|
||||||
log_info("Legacy capabilities, nodes match %s", node);
|
log_info("Legacy capabilities, nodes match %s", node);
|
||||||
|
Loading…
Reference in New Issue
Block a user