diff --git a/src/chatview.cpp b/src/chatview.cpp index 03e3e608181d0a3ad677bdc278b04151205bbae5..0e4d0c3432bb43b40f886cd78cb3c13cd6d8e894 100644 --- a/src/chatview.cpp +++ b/src/chatview.cpp @@ -306,10 +306,11 @@ update_contact_methods(ChatView *self) if (!priv->conversation_) return; auto contactUri = priv->conversation_->participants.front(); auto contactInfo = priv->accountContainer_->info.contactModel->getContact(contactUri); - if (contactInfo.profileInfo.alias == contactInfo.registeredName) { + auto bestId = std::string(contactInfo.registeredName).empty() ? contactInfo.profileInfo.uri : contactInfo.registeredName; + if (contactInfo.profileInfo.alias == bestId) { gtk_widget_hide(priv->label_cm); } else { - gtk_label_set_text(GTK_LABEL(priv->label_cm), contactInfo.registeredName.c_str()); + gtk_label_set_text(GTK_LABEL(priv->label_cm), bestId.c_str()); gtk_widget_show(priv->label_cm); } diff --git a/src/conversationsview.cpp b/src/conversationsview.cpp index b89d402db5bd891cf55ad5876b655b975a98736f..54504ca3684260bf28f0dc087525b8cb32047290 100644 --- a/src/conversationsview.cpp +++ b/src/conversationsview.cpp @@ -121,23 +121,26 @@ render_name_and_last_interaction(G_GNUC_UNUSED GtkTreeViewColumn *tree_column, gchar *lastInteraction; gchar *text; gchar *uid; + gchar *uri; gtk_tree_model_get (model, iter, 0 /* col# */, &uid /* data */, 1 /* col# */, &alias /* data */, - 2 /* col# */, ®isteredName /* data */, - 4 /* col# */, &lastInteraction /* data */, + 2 /* col# */, &uri /* data */, + 3 /* col# */, ®isteredName /* data */, + 5 /* col# */, &lastInteraction /* data */, -1); + auto bestId = std::string(registeredName).empty() ? uri: registeredName; if (std::string(alias).empty()) { // For conversations with contacts with no alias text = g_markup_printf_escaped( "<span font_weight=\"bold\">%s</span>\n<span size=\"smaller\" color=\"#666\">%s</span>", - registeredName, + bestId, lastInteraction ); - } else if (std::string(alias) == std::string(registeredName) - || std::string(registeredName).empty() || std::string(uid).empty()) { + } else if (std::string(alias) == std::string(bestId) + || std::string(bestId).empty() || std::string(uid).empty()) { // For temporary item text = g_markup_printf_escaped( "<span font_weight=\"bold\">%s</span>\n<span size=\"smaller\" color=\"#666\">%s</span>", @@ -149,13 +152,14 @@ render_name_and_last_interaction(G_GNUC_UNUSED GtkTreeViewColumn *tree_column, text = g_markup_printf_escaped( "<span font_weight=\"bold\">%s</span>\n<span size=\"smaller\" color=\"#666\">%s</span>\n<span size=\"smaller\" color=\"#666\">%s</span>", alias, - registeredName, + bestId, lastInteraction ); } g_object_set(G_OBJECT(cell), "markup", text, NULL); g_free(uid); + g_free(uri); g_free(alias); g_free(registeredName); } @@ -222,7 +226,8 @@ static GtkTreeModel* create_and_fill_model(ConversationsView *self) { auto priv = CONVERSATIONS_VIEW_GET_PRIVATE(self); - auto store = gtk_list_store_new (5 /* # of cols */ , + auto store = gtk_list_store_new (6 /* # of cols */ , + G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, @@ -245,9 +250,10 @@ create_and_fill_model(ConversationsView *self) gtk_list_store_set (store, &iter, 0 /* col # */ , conversation.uid.c_str() /* celldata */, 1 /* col # */ , alias.c_str() /* celldata */, - 2 /* col # */ , contactInfo.registeredName.c_str() /* celldata */, - 3 /* col # */ , contactInfo.profileInfo.avatar.c_str() /* celldata */, - 4 /* col # */ , lastMessage.c_str() /* celldata */, + 2 /* col # */ , contactInfo.profileInfo.uri.c_str() /* celldata */, + 3 /* col # */ , contactInfo.registeredName.c_str() /* celldata */, + 4 /* col # */ , contactInfo.profileInfo.avatar.c_str() /* celldata */, + 5 /* col # */ , lastMessage.c_str() /* celldata */, -1 /* end */); } diff --git a/src/currentcallview.cpp b/src/currentcallview.cpp index 6bcd70aa38178dbb22a0c05ff0ca37db1440775f..932efe4c51c4823497dd82bc4f3fc40b916fbd68 100644 --- a/src/currentcallview.cpp +++ b/src/currentcallview.cpp @@ -378,7 +378,6 @@ set_quality(Call *call, gboolean auto_quality_on, double desired_quality) static void autoquality_toggled(GtkToggleButton *button, CurrentCallView *self) { - // TODO g_return_if_fail(IS_CURRENT_CALL_VIEW(self)); CurrentCallViewPrivate *priv = CURRENT_CALL_VIEW_GET_PRIVATE(self); @@ -406,7 +405,6 @@ autoquality_toggled(GtkToggleButton *button, CurrentCallView *self) static void quality_changed(G_GNUC_UNUSED GtkScaleButton *button, G_GNUC_UNUSED gdouble value, CurrentCallView *self) { - // TODO g_return_if_fail(IS_CURRENT_CALL_VIEW(self)); CurrentCallViewPrivate *priv = CURRENT_CALL_VIEW_GET_PRIVATE(self);