Commit fab5b9b7 authored by Simon Morlat's avatar Simon Morlat
Browse files

support to display encryption

parent 7e126739
......@@ -86,7 +86,8 @@ const char* linphone_call_get_authentication_token(LinphoneCall *call){
bool_t linphone_call_get_authentication_token_verified(LinphoneCall *call){
return call->auth_token_verified;
}
bool_t linphone_call_are_all_streams_encrypted(LinphoneCall *call) {
static bool_t linphone_call_are_all_streams_encrypted(LinphoneCall *call) {
// Check ZRTP encryption in audiostream
if (!call->audiostream_encrypted) {
return FALSE;
......@@ -104,14 +105,16 @@ bool_t linphone_call_are_all_streams_encrypted(LinphoneCall *call) {
}
void propagate_encryption_changed(LinphoneCall *call){
if (call->core->vtable.call_encryption_changed == NULL) return;
LinphoneCore *lc=call->core;
if (!linphone_call_are_all_streams_encrypted(call)) {
ms_message("Some streams are not encrypted");
call->core->vtable.call_encryption_changed(call->core, call, FALSE, call->auth_token);
if (lc->vtable.call_encryption_changed)
lc->vtable.call_encryption_changed(call->core, call, FALSE, call->auth_token);
} else {
ms_message("All streams are encrypted");
call->core->vtable.call_encryption_changed(call->core, call, TRUE, call->auth_token);
call->current_params.media_encryption=LinphoneMediaEncryptionZRTP;
if (lc->vtable.call_encryption_changed)
lc->vtable.call_encryption_changed(call->core, call, TRUE, call->auth_token);
}
}
......@@ -131,7 +134,7 @@ static void linphone_call_audiostream_encryption_changed(void *data, bool_t encr
LinphoneCall *call = (LinphoneCall *)data;
call->audiostream_encrypted=encrypted;
if (encrypted && call->core->vtable.display_status != NULL) {
snprintf(status,sizeof(status)-1,_("Authentication token is %s"),call->auth_token);
call->core->vtable.display_status(call->core, status);
......@@ -719,7 +722,7 @@ bool_t linphone_call_params_video_enabled(const LinphoneCallParams *cp){
return cp->has_video;
}
enum LinphoneMediaEncryption linphone_call_params_get_media_encryption(LinphoneCallParams *cp) {
enum LinphoneMediaEncryption linphone_call_params_get_media_encryption(const LinphoneCallParams *cp) {
return cp->media_encryption;
}
......@@ -1259,8 +1262,11 @@ void linphone_call_start_media_streams(LinphoneCall *call, bool_t all_inputs_mut
call->playing_ringbacktone=send_ringbacktone;
call->up_bw=linphone_core_get_upload_bandwidth(lc);
if (ortp_zrtp_available()) {
if (call->params.media_encryption==LinphoneMediaEncryptionZRTP) {
OrtpZrtpParams params;
/*will be set later when zrtp is activated*/
call->current_params.media_encryption=LinphoneMediaEncryptionNone;
params.zid=get_hexa_zrtp_identifier(lc);
params.zid_file=lc->zrtp_secrets_cache;
audio_stream_enable_zrtp(call->audiostream,&params);
......
......@@ -185,8 +185,8 @@ typedef struct _LinphoneCallParams LinphoneCallParams;
LinphoneCallParams * linphone_call_params_copy(const LinphoneCallParams *cp);
void linphone_call_params_enable_video(LinphoneCallParams *cp, bool_t enabled);
bool_t linphone_call_params_video_enabled(const LinphoneCallParams *cp);
enum LinphoneMediaEncryption linphone_call_params_get_media_encryption(LinphoneCallParams *cp);
void linphone_call_params_set_media_encryption(LinphoneCallParams *cp, enum LinphoneMediaEncryption e);
LinphoneMediaEncryption linphone_call_params_get_media_encryption(const LinphoneCallParams *cp);
void linphone_call_params_set_media_encryption(LinphoneCallParams *cp, LinphoneMediaEncryption e);
void linphone_call_params_enable_early_media_sending(LinphoneCallParams *cp, bool_t enabled);
bool_t linphone_call_params_early_media_sending_enabled(const LinphoneCallParams *cp);
bool_t linphone_call_params_local_conference_mode(const LinphoneCallParams *cp);
......@@ -267,7 +267,6 @@ float linphone_call_get_play_volume(LinphoneCall *call);
float linphone_call_get_record_volume(LinphoneCall *call);
float linphone_call_get_current_quality(LinphoneCall *call);
float linphone_call_get_average_quality(LinphoneCall *call);
bool_t linphone_call_are_all_streams_encrypted(LinphoneCall *call);
const char* linphone_call_get_authentication_token(LinphoneCall *call);
bool_t linphone_call_get_authentication_token_verified(LinphoneCall *call);
void linphone_call_send_vfu_request(LinphoneCall *call);
......
......@@ -60,11 +60,12 @@
struct _LinphoneCallParams{
LinphoneCall *referer; /*in case this call creation is consecutive to an incoming transfer, this points to the original call */
int audio_bw; /* bandwidth limit for audio stream */
LinphoneMediaEncryption media_encryption;
bool_t has_video;
bool_t real_early_media; /*send real media even during early media (for outgoing calls)*/
bool_t in_conference; /*in conference mode */
bool_t pad;
enum LinphoneMediaEncryption media_encryption;
};
struct _LinphoneCall
......
......@@ -78,15 +78,19 @@ static void linphone_gtk_in_call_set_animation_image(GtkWidget *callview, const
GtkWidget *container=linphone_gtk_get_widget(callview,"in_call_animation");
GList *elem=gtk_container_get_children(GTK_CONTAINER(container));
GtkWidget *image;
if (!is_stock)
if (!is_stock){
if (image_name==NULL){
gtk_widget_hide(container);
}
image=create_pixmap(image_name);
else
}else
image=gtk_image_new_from_stock(image_name,GTK_ICON_SIZE_DIALOG);
if (elem)
gtk_widget_destroy((GtkWidget*)elem->data);
gtk_widget_show(image);
gtk_container_add(GTK_CONTAINER(container),image);
gtk_widget_show_all(container);
}
static void linphone_gtk_in_call_set_animation_spinner(GtkWidget *callview){
......@@ -97,6 +101,7 @@ static void linphone_gtk_in_call_set_animation_spinner(GtkWidget *callview){
gtk_widget_destroy((GtkWidget*)elem->data);
gtk_widget_show(spinner);
gtk_container_add(GTK_CONTAINER(container),spinner);
gtk_widget_set_size_request(spinner, 20,20);
gtk_spinner_start(GTK_SPINNER(spinner));
}
......@@ -421,6 +426,29 @@ void linphone_gtk_in_call_view_enable_audio_view(LinphoneCall *call, gboolean va
}
}
static void linphone_gtk_in_call_view_show_encryption(LinphoneCall *call){
GtkWidget *callview=(GtkWidget*)linphone_call_get_user_pointer(call);
GtkWidget *encryption_box=linphone_gtk_get_widget(callview,"encryption_box");
GtkWidget *label=linphone_gtk_get_widget(callview,"encryption_label");
LinphoneMediaEncryption me=linphone_call_params_get_media_encryption(linphone_call_get_current_params(call));
switch(me){
case LinphoneMediaEncryptionSRTP:
gtk_label_set_markup(GTK_LABEL(label),_("Secured by SRTP"));
gtk_widget_show_all(encryption_box);
break;
case LinphoneMediaEncryptionZRTP:
{
gchar *text=g_strdup_printf(_("Secured by ZRTP - [auth token: %s]"),linphone_call_get_authentication_token(call));
gtk_label_set_markup(GTK_LABEL(label),text);
g_free(text);
gtk_widget_show_all(encryption_box);
}
break;
default:
gtk_widget_hide(encryption_box);
}
}
void linphone_gtk_in_call_view_set_in_call(LinphoneCall *call){
GtkWidget *callview=(GtkWidget*)linphone_call_get_user_pointer(call);
GtkWidget *status=linphone_gtk_get_widget(callview,"in_call_status");
......@@ -444,6 +472,7 @@ void linphone_gtk_in_call_view_set_in_call(LinphoneCall *call){
g_object_set_data(G_OBJECT(callview),"taskid",GINT_TO_POINTER(taskid));
}
linphone_gtk_in_call_view_enable_audio_view(call, !in_conf);
linphone_gtk_in_call_view_show_encryption(call);
if (in_conf) linphone_gtk_set_in_conference(call);
}
......
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk+" version="2.16"/>
<!-- interface-naming-policy toplevel-contextual -->
<requires lib="gtk+" version="2.24"/>
<object class="GtkWindow" id="dummy_conf_window">
<property name="can_focus">False</property>
<child>
......@@ -100,29 +99,53 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkHBox" id="incall_hbox1">
<object class="GtkVBox" id="in_call_animation">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkVBox" id="in_call_animation">
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="in_call_uri">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">label</property>
<property name="justify">center</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkHBox" id="encryption_box">
<property name="can_focus">False</property>
<child>
<object class="GtkImage" id="image12">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<placeholder/>
</child>
<property name="stock">gtk-dialog-authentication</property>
<property name="icon-size">1</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="in_call_uri">
<object class="GtkLabel" id="encryption_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">label</property>
<property name="justify">center</property>
</object>
<packing>
<property name="expand">True</property>
......@@ -130,11 +153,14 @@
<property name="position">1</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
</packing>
</child>
<child>
......@@ -194,7 +220,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
<property name="position">3</property>
</packing>
</child>
<child>
......@@ -235,7 +261,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
<property name="position">4</property>
</packing>
</child>
<child>
......@@ -262,7 +288,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">3</property>
<property name="position">5</property>
</packing>
</child>
</object>
......@@ -583,8 +609,6 @@
<property name="invisible_char"></property>
<property name="primary_icon_activatable">False</property>
<property name="secondary_icon_activatable">False</property>
<property name="primary_icon_sensitive">True</property>
<property name="secondary_icon_sensitive">True</property>
<signal name="activate" handler="linphone_gtk_uri_bar_activate" swapped="no"/>
</object>
<packing>
......@@ -676,8 +700,6 @@
<property name="invisible_char_set">True</property>
<property name="primary_icon_activatable">False</property>
<property name="secondary_icon_activatable">False</property>
<property name="primary_icon_sensitive">True</property>
<property name="secondary_icon_sensitive">True</property>
<signal name="changed" handler="linphone_gtk_show_friends" swapped="no"/>
</object>
<packing>
......@@ -734,8 +756,6 @@
<object class="GtkScrolledWindow" id="scrolledwindow1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">automatic</property>
<property name="vscrollbar_policy">automatic</property>
<child>
<object class="GtkTreeView" id="contact_list">
<property name="visible">True</property>
......@@ -745,6 +765,9 @@
<signal name="cursor-changed" handler="linphone_gtk_contact_clicked" swapped="no"/>
<signal name="row-activated" handler="linphone_gtk_contact_activated" swapped="no"/>
<signal name="popup-menu" handler="linphone_gtk_popup_contact_menu" swapped="no"/>
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection1"/>
</child>
</object>
</child>
</object>
......@@ -770,8 +793,6 @@
<property name="invisible_char_set">True</property>
<property name="primary_icon_activatable">False</property>
<property name="secondary_icon_activatable">False</property>
<property name="primary_icon_sensitive">True</property>
<property name="secondary_icon_sensitive">True</property>
<signal name="activate" handler="linphone_gtk_directory_search_activate" swapped="no"/>
<signal name="icon-press" handler="linphone_gtk_directory_search_activate" swapped="no"/>
<signal name="focus-in-event" handler="linphone_gtk_directory_search_focus_in" swapped="no"/>
......@@ -975,13 +996,15 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">never</property>
<property name="vscrollbar_policy">automatic</property>
<child>
<object class="GtkTreeView" id="logs_view">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="headers_visible">False</property>
<signal name="row-activated" handler="linphone_gtk_history_row_activated" swapped="no"/>
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection2"/>
</child>
</object>
</child>
</object>
......@@ -1485,8 +1508,6 @@
<property name="invisible_char"></property>
<property name="primary_icon_activatable">False</property>
<property name="secondary_icon_activatable">False</property>
<property name="primary_icon_sensitive">True</property>
<property name="secondary_icon_sensitive">True</property>
</object>
<packing>
<property name="left_attach">1</property>
......@@ -1501,8 +1522,6 @@
<property name="invisible_char"></property>
<property name="primary_icon_activatable">False</property>
<property name="secondary_icon_activatable">False</property>
<property name="primary_icon_sensitive">True</property>
<property name="secondary_icon_sensitive">True</property>
</object>
<packing>
<property name="left_attach">1</property>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment