mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-28 00:29:21 +00:00
gtk: add lime icon in chat
This commit is contained in:
parent
43997b3dad
commit
2fc0aef1b9
5 changed files with 41 additions and 9 deletions
|
|
@ -288,6 +288,7 @@ bool_t linphone_chat_room_lime_available(LinphoneChatRoom *cr) {
|
|||
cacheXml = xmlParseDoc((xmlChar*)cacheString);
|
||||
ms_free(cacheString);
|
||||
if (cacheXml) {
|
||||
bool_t res;
|
||||
limeURIKeys_t associatedKeys;
|
||||
/* retrieve keys associated to the peer URI */
|
||||
associatedKeys.peerURI = (uint8_t *)malloc(strlen(cr->peer)+1);
|
||||
|
|
@ -295,13 +296,10 @@ bool_t linphone_chat_room_lime_available(LinphoneChatRoom *cr) {
|
|||
associatedKeys.associatedZIDNumber = 0;
|
||||
associatedKeys.peerKeys = NULL;
|
||||
|
||||
if (lime_getCachedSndKeysByURI(cacheXml, &associatedKeys) != 0) {
|
||||
lime_freeKeys(associatedKeys);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
res = (lime_getCachedSndKeysByURI(cacheXml, &associatedKeys) == 0 && associatedKeys.associatedZIDNumber != 0);
|
||||
lime_freeKeys(associatedKeys);
|
||||
xmlFreeDoc(cacheXml);
|
||||
return TRUE;
|
||||
return res;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1513,6 +1513,13 @@ LINPHONE_PUBLIC LinphoneCore* linphone_chat_room_get_core(LinphoneChatRoom *cr);
|
|||
*/
|
||||
LINPHONE_PUBLIC uint32_t linphone_chat_room_get_char(const LinphoneChatRoom *cr);
|
||||
|
||||
/**
|
||||
* Returns true if lime is available for given peer
|
||||
*
|
||||
* @return true if zrtp secrets have already been shared and ready to use
|
||||
*/
|
||||
LINPHONE_PUBLIC bool_t linphone_chat_room_lime_available(LinphoneChatRoom *cr);
|
||||
|
||||
/**
|
||||
* Returns an list of chat rooms
|
||||
* @param[in] lc #LinphoneCore object
|
||||
|
|
|
|||
|
|
@ -591,7 +591,6 @@ int linphone_chat_room_upload_file(LinphoneChatMessage *msg);
|
|||
void _linphone_chat_room_send_message(LinphoneChatRoom *cr, LinphoneChatMessage *msg);
|
||||
LinphoneChatMessageCbs *linphone_chat_message_cbs_new(void);
|
||||
LinphoneChatRoom *_linphone_core_create_chat_room_from_call(LinphoneCall *call);
|
||||
bool_t linphone_chat_room_lime_available(LinphoneChatRoom *cr);
|
||||
/**/
|
||||
|
||||
struct _LinphoneProxyConfig
|
||||
|
|
|
|||
14
gtk/chat.c
14
gtk/chat.c
|
|
@ -468,6 +468,15 @@ static gboolean copy_uri_into_clipboard_handler(GtkMenuItem *menuitem, gpointer
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
static void refresh_lime_icon(GtkWidget* chat_view, LinphoneChatRoom*cr) {
|
||||
GtkWidget *lime_icon = linphone_gtk_get_widget(chat_view, "lime_icon");
|
||||
if (linphone_chat_room_lime_available(cr)) {
|
||||
gtk_widget_show(lime_icon);
|
||||
} else {
|
||||
gtk_widget_hide(lime_icon);
|
||||
}
|
||||
}
|
||||
|
||||
static gint linphone_gtk_window_focused(GtkWidget* widget, GdkEvent *event, gpointer user_data) {
|
||||
// if we are in a chat, mark it as read
|
||||
GtkWidget *main_window=linphone_gtk_get_main_window();
|
||||
|
|
@ -477,6 +486,7 @@ static gint linphone_gtk_window_focused(GtkWidget* widget, GdkEvent *event, gpoi
|
|||
if (cr) {
|
||||
linphone_gtk_mark_chat_read(cr);
|
||||
}
|
||||
refresh_lime_icon(w, cr);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
@ -559,6 +569,8 @@ GtkWidget* linphone_gtk_init_chatroom(LinphoneChatRoom *cr, const LinphoneAddres
|
|||
|
||||
gtk_signal_connect(GTK_OBJECT(main_window), "focus-in-event", GTK_SIGNAL_FUNC(linphone_gtk_window_focused), NULL);
|
||||
|
||||
refresh_lime_icon(chat_view, cr);
|
||||
|
||||
return chat_view;
|
||||
}
|
||||
|
||||
|
|
@ -595,6 +607,8 @@ void linphone_gtk_load_chatroom(LinphoneChatRoom *cr,const LinphoneAddress *uri,
|
|||
gtk_text_buffer_get_end_iter(text_buffer,&end);
|
||||
gtk_text_view_scroll_to_iter(text_view,&end,0,FALSE,1.0,0);
|
||||
}
|
||||
refresh_lime_icon(chat_view, cr);
|
||||
|
||||
ms_free(from_str);
|
||||
ms_free(uri_str);
|
||||
ms_free(uri_only);
|
||||
|
|
|
|||
|
|
@ -37,6 +37,20 @@
|
|||
<object class="GtkHBox" id="hbox10">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">10</property>
|
||||
<child>
|
||||
<object class="GtkImage" id="lime_icon">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="pixel_size">16</property>
|
||||
<property name="icon_name">linphone-security-ok</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="text_entry">
|
||||
<property name="visible">True</property>
|
||||
|
|
@ -51,7 +65,7 @@
|
|||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
|
|
@ -94,7 +108,7 @@
|
|||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">1</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue