Uncrustify sources

Ran `find src plugins -iname '*.[c|h]' -print0 | xargs -0 uncrustify --no-backup`
with some minimal manual intervention.
This commit is contained in:
Evangelos Ribeiro Tzaras
2022-04-24 12:24:55 +02:00
parent 8daa502de5
commit 7ac862155b
83 changed files with 1744 additions and 1869 deletions

View File

@@ -97,10 +97,10 @@ is_form_filled (CallsSipAccountWidget *self)
g_assert (CALLS_IS_SIP_ACCOUNT_WIDGET (self));
return
g_strcmp0 (gtk_entry_get_text (GTK_ENTRY (self->host)), "") != 0 &&
g_strcmp0 (gtk_entry_get_text (GTK_ENTRY (self->user)), "") != 0 &&
g_strcmp0 (gtk_entry_get_text (GTK_ENTRY (self->password)), "") != 0 &&
g_strcmp0 (gtk_entry_get_text (GTK_ENTRY (self->port)), "") != 0;
g_strcmp0 (gtk_entry_get_text (self->host), "") != 0 &&
g_strcmp0 (gtk_entry_get_text (self->user), "") != 0 &&
g_strcmp0 (gtk_entry_get_text (self->password), "") != 0 &&
g_strcmp0 (gtk_entry_get_text (self->port), "") != 0;
}
@@ -122,35 +122,35 @@ on_user_changed (CallsSipAccountWidget *self)
static void
set_password_visibility (CallsSipAccountWidget *self, gboolean visible)
{
const char* icon_name;
const char *icon_name;
g_assert (CALLS_IS_SIP_ACCOUNT_WIDGET (self));
g_assert (GTK_IS_ENTRY (self->password));
g_assert (CALLS_IS_SIP_ACCOUNT_WIDGET (self));
g_assert (GTK_IS_ENTRY (self->password));
icon_name = visible ?
"view-conceal-symbolic" :
"view-reveal-symbolic";
icon_name = visible ?
"view-conceal-symbolic" :
"view-reveal-symbolic";
gtk_entry_set_visibility (self->password, visible);
gtk_entry_set_icon_from_icon_name (self->password, GTK_ENTRY_ICON_SECONDARY,
icon_name);
gtk_entry_set_visibility (self->password, visible);
gtk_entry_set_icon_from_icon_name (self->password, GTK_ENTRY_ICON_SECONDARY,
icon_name);
}
static void
on_password_visibility_changed(CallsSipAccountWidget *self,
GtkEntryIconPosition icon_pos,
GdkEvent *event,
GtkEntry *entry)
on_password_visibility_changed (CallsSipAccountWidget *self,
GtkEntryIconPosition icon_pos,
GdkEvent *event,
GtkEntry *entry)
{
gboolean visible;
gboolean visible;
g_assert (CALLS_IS_SIP_ACCOUNT_WIDGET (self));
g_assert (GTK_IS_ENTRY (entry));
g_assert (icon_pos == GTK_ENTRY_ICON_SECONDARY);
g_assert (CALLS_IS_SIP_ACCOUNT_WIDGET (self));
g_assert (GTK_IS_ENTRY (entry));
g_assert (icon_pos == GTK_ENTRY_ICON_SECONDARY);
visible = !gtk_entry_get_visibility (entry);
set_password_visibility (self, visible);
visible = !gtk_entry_get_visibility (entry);
set_password_visibility (self, visible);
}
/*
@@ -173,7 +173,7 @@ on_port_entry_insert_text (CallsSipAccountWidget *self,
if (!new_text || !*new_text || self->port_self_change)
return;
pos = (int *)position;
pos = (int *) position;
g_object_set_data (G_OBJECT (entry), "old-pos", GINT_TO_POINTER (*pos));
if (new_text_length == -1)
@@ -215,7 +215,7 @@ get_port (CallsSipAccountWidget *self)
int port = 0;
text = gtk_entry_get_text (self->port);
port = (int)g_ascii_strtod (text, NULL);
port = (int) g_ascii_strtod (text, NULL);
return port;
}
@@ -270,6 +270,7 @@ find_protocol (CallsSipAccountWidget *self,
guint *index)
{
guint len;
g_assert (CALLS_IS_SIP_ACCOUNT_WIDGET (self));
len = g_list_model_get_n_items (G_LIST_MODEL (self->protocols_store));
@@ -352,7 +353,7 @@ edit_form (CallsSipAccountWidget *self,
/* The following should always succeed,
TODO inform user in the error case
related issue #275 https://source.puri.sm/Librem5/calls/-/issues/275
*/
*/
if (!find_protocol (self, protocol, &protocol_index))
protocol_index = 0;

View File

@@ -35,8 +35,8 @@ G_BEGIN_DECLS
G_DECLARE_FINAL_TYPE (CallsSipAccountWidget, calls_sip_account_widget, CALLS, SIP_ACCOUNT_WIDGET, GtkBox)
CallsSipAccountWidget *calls_sip_account_widget_new (CallsSipProvider *provider);
void calls_sip_account_widget_set_origin (CallsSipAccountWidget *self,
CallsSipOrigin *origin);
CallsSipOrigin *calls_sip_account_widget_get_origin (CallsSipAccountWidget *self);
void calls_sip_account_widget_set_origin (CallsSipAccountWidget *self,
CallsSipOrigin *origin);
CallsSipOrigin *calls_sip_account_widget_get_origin (CallsSipAccountWidget *self);
G_END_DECLS

View File

@@ -56,21 +56,20 @@ enum {
};
static GParamSpec *props[PROP_LAST_PROP];
struct _CallsSipCall
{
GObject parent_instance;
struct _CallsSipCall {
GObject parent_instance;
CallsSipMediaManager *manager;
CallsSipMediaManager *manager;
CallsSipMediaPipeline *pipeline;
char *ip;
char *ip;
guint rport_rtp;
guint rport_rtcp;
gchar *remote;
guint rport_rtp;
guint rport_rtcp;
gchar *remote;
nua_handle_t *nh;
GList *codecs;
nua_handle_t *nh;
GList *codecs;
};
static void calls_sip_call_message_source_interface_init (CallsMessageSourceInterface *iface);
@@ -219,10 +218,10 @@ calls_sip_call_set_property (GObject *object,
static void
calls_sip_call_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec)
calls_sip_call_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec)
{
CallsSipCall *self = CALLS_SIP_CALL (object);

View File

@@ -37,20 +37,20 @@ G_BEGIN_DECLS
G_DECLARE_FINAL_TYPE (CallsSipCall, calls_sip_call, CALLS, SIP_CALL, CallsCall)
CallsSipCall *calls_sip_call_new (const char *number,
gboolean inbound,
gboolean inbound,
const char *own_ip,
CallsSipMediaPipeline *pipeline,
nua_handle_t *handle);
void calls_sip_call_setup_remote_media_connection (CallsSipCall *self,
const char *remote,
guint port_rtp,
guint port_rtcp);
void calls_sip_call_setup_local_media_connection (CallsSipCall *self);
void calls_sip_call_activate_media (CallsSipCall *self,
gboolean enabled);
void calls_sip_call_set_state (CallsSipCall *self,
CallsCallState state);
void calls_sip_call_set_codecs (CallsSipCall *self,
GList *codecs);
void calls_sip_call_setup_remote_media_connection (CallsSipCall *self,
const char *remote,
guint port_rtp,
guint port_rtcp);
void calls_sip_call_setup_local_media_connection (CallsSipCall *self);
void calls_sip_call_activate_media (CallsSipCall *self,
gboolean enabled);
void calls_sip_call_set_state (CallsSipCall *self,
CallsCallState state);
void calls_sip_call_set_codecs (CallsSipCall *self,
GList *codecs);
G_END_DECLS

View File

@@ -48,16 +48,15 @@
* #CallsSipMediaPipeline objects that are ready to be used.
*/
typedef struct _CallsSipMediaManager
{
GObject parent;
typedef struct _CallsSipMediaManager {
GObject parent;
int address_family;
int address_family;
struct addrinfo hints;
CallsSettings *settings;
GList *preferred_codecs;
GListStore *pipelines;
CallsSettings *settings;
GList *preferred_codecs;
GListStore *pipelines;
} CallsSipMediaManager;
G_DEFINE_TYPE (CallsSipMediaManager, calls_sip_media_manager, G_TYPE_OBJECT);
@@ -95,6 +94,7 @@ static void
on_notify_preferred_audio_codecs (CallsSipMediaManager *self)
{
GList *supported_codecs;
g_auto (GStrv) settings_codec_preference = NULL;
g_assert (CALLS_IS_SIP_MEDIA_MANAGER (self));
@@ -173,7 +173,7 @@ calls_sip_media_manager_class_init (CallsSipMediaManagerClass *klass)
static void
calls_sip_media_manager_init (CallsSipMediaManager *self)
{
if (!gst_is_initialized())
if (!gst_is_initialized ())
gst_init (NULL, NULL);
self->settings = calls_settings_new ();
@@ -228,6 +228,7 @@ calls_sip_media_manager_get_capabilities (CallsSipMediaManager *self,
GList *supported_codecs)
{
char *payload_type = use_srtp ? "SAVP" : "AVP";
g_autoptr (GString) media_line = NULL;
g_autoptr (GString) attribute_lines = NULL;
GList *node;
@@ -262,7 +263,7 @@ calls_sip_media_manager_get_capabilities (CallsSipMediaManager *self,
g_string_append_printf (attribute_lines, "a=rtcp:%d\r\n", rtcp_port);
done:
done:
if (own_ip && *own_ip)
address_family_string = get_address_family_string (self, own_ip);

View File

@@ -38,22 +38,22 @@ G_DECLARE_FINAL_TYPE (CallsSipMediaManager, calls_sip_media_manager, CALLS, SIP_
CallsSipMediaManager* calls_sip_media_manager_default (void);
gchar* calls_sip_media_manager_get_capabilities (CallsSipMediaManager *self,
const char *own_ip,
gint rtp_port,
gint rtcp_port,
gboolean use_srtp,
GList *supported_codecs);
gchar* calls_sip_media_manager_static_capabilities (CallsSipMediaManager *self,
const char *own_ip,
gint rtp_port,
gint rtcp_port,
gboolean use_srtp);
gboolean calls_sip_media_manager_supports_media (CallsSipMediaManager *self,
const char *media_type);
GList * calls_sip_media_manager_codec_candidates (CallsSipMediaManager *self);
GList * calls_sip_media_manager_get_codecs_from_sdp (CallsSipMediaManager *self,
sdp_media_t *sdp_media);
CallsSipMediaPipeline *calls_sip_media_manager_get_pipeline (CallsSipMediaManager *self);
gchar *calls_sip_media_manager_get_capabilities (CallsSipMediaManager *self,
const char *own_ip,
gint rtp_port,
gint rtcp_port,
gboolean use_srtp,
GList *supported_codecs);
gchar *calls_sip_media_manager_static_capabilities (CallsSipMediaManager *self,
const char *own_ip,
gint rtp_port,
gint rtcp_port,
gboolean use_srtp);
gboolean calls_sip_media_manager_supports_media (CallsSipMediaManager *self,
const char *media_type);
GList *calls_sip_media_manager_codec_candidates (CallsSipMediaManager *self);
GList *calls_sip_media_manager_get_codecs_from_sdp (CallsSipMediaManager *self,
sdp_media_t *sdp_media);
CallsSipMediaPipeline *calls_sip_media_manager_get_pipeline (CallsSipMediaManager *self);
G_END_DECLS

View File

@@ -113,44 +113,44 @@ static uint signals[N_SIGNALS];
struct _CallsSipMediaPipeline {
GObject parent;
GObject parent;
MediaCodecInfo *codec;
gboolean debug;
MediaCodecInfo *codec;
gboolean debug;
CallsMediaPipelineState state;
uint element_map_playing;
uint element_map_paused;
uint element_map_stopped;
gboolean emitted_sending_signal;
uint element_map_playing;
uint element_map_paused;
uint element_map_stopped;
gboolean emitted_sending_signal;
/* Connection details */
char *remote;
gint rport_rtp;
gint rport_rtcp;
char *remote;
gint rport_rtp;
gint rport_rtcp;
GstElement *pipeline;
GstElement *rtpbin;
GstElement *pipeline;
GstElement *rtpbin;
GstElement *rtp_src;
GstElement *rtp_sink;
GstElement *rtcp_sink;
GstElement *rtcp_src;
GstElement *rtp_src;
GstElement *rtp_sink;
GstElement *rtcp_sink;
GstElement *rtcp_src;
GstElement *audio_src;
GstElement *payloader;
GstElement *encoder;
GstElement *audio_src;
GstElement *payloader;
GstElement *encoder;
GstElement *audio_sink;
GstElement *depayloader;
GstElement *decoder;
GstElement *audio_sink;
GstElement *depayloader;
GstElement *decoder;
/* Gstreamer busses */
GstBus *bus;
guint bus_watch_id;
GstBus *bus;
guint bus_watch_id;
};
#if GLIB_CHECK_VERSION(2, 70, 0)
#if GLIB_CHECK_VERSION (2, 70, 0)
G_DEFINE_FINAL_TYPE (CallsSipMediaPipeline, calls_sip_media_pipeline, G_TYPE_OBJECT)
#else
G_DEFINE_TYPE (CallsSipMediaPipeline, calls_sip_media_pipeline, G_TYPE_OBJECT)
@@ -254,24 +254,24 @@ on_bus_message (GstBus *bus,
switch (GST_MESSAGE_TYPE (message)) {
case GST_MESSAGE_ERROR:
{
g_autoptr (GError) error = NULL;
g_autofree char *msg = NULL;
{
g_autoptr (GError) error = NULL;
g_autofree char *msg = NULL;
gst_message_parse_error (message, &error, &msg);
g_warning ("Error on the message bus: %s (%s)", error->message, msg);
break;
}
gst_message_parse_error (message, &error, &msg);
g_warning ("Error on the message bus: %s (%s)", error->message, msg);
break;
}
case GST_MESSAGE_WARNING:
{
g_autoptr (GError) error = NULL;
g_autofree char *msg = NULL;
{
g_autoptr (GError) error = NULL;
g_autofree char *msg = NULL;
gst_message_parse_warning (message, &error, &msg);
g_warning ("Warning on the message bus: %s (%s)", error->message, msg);
break;
}
gst_message_parse_warning (message, &error, &msg);
g_warning ("Warning on the message bus: %s (%s)", error->message, msg);
break;
}
case GST_MESSAGE_EOS:
g_debug ("Received end of stream");
@@ -279,77 +279,77 @@ on_bus_message (GstBus *bus,
break;
case GST_MESSAGE_STATE_CHANGED:
{
GstState oldstate;
GstState newstate;
uint element_id = 0;
uint unset_element_id;
{
GstState oldstate;
GstState newstate;
uint element_id = 0;
uint unset_element_id;
gst_message_parse_state_changed (message, &oldstate, &newstate, NULL);
gst_message_parse_state_changed (message, &oldstate, &newstate, NULL);
g_debug ("Element %s has changed state from %s to %s",
GST_OBJECT_NAME (message->src),
gst_element_state_get_name (oldstate),
gst_element_state_get_name (newstate));
g_debug ("Element %s has changed state from %s to %s",
GST_OBJECT_NAME (message->src),
gst_element_state_get_name (oldstate),
gst_element_state_get_name (newstate));
if (message->src == GST_OBJECT (self->pipeline))
element_id = EL_PIPELINE;
else if (message->src == GST_OBJECT (self->rtpbin))
element_id = EL_RTPBIN;
if (message->src == GST_OBJECT (self->pipeline))
element_id = EL_PIPELINE;
else if (message->src == GST_OBJECT (self->rtpbin))
element_id = EL_RTPBIN;
else if (message->src == GST_OBJECT (self->rtp_src))
element_id = EL_RTP_SRC;
else if (message->src == GST_OBJECT (self->rtp_sink))
element_id = EL_RTP_SINK;
else if (message->src == GST_OBJECT (self->rtp_src))
element_id = EL_RTP_SRC;
else if (message->src == GST_OBJECT (self->rtp_sink))
element_id = EL_RTP_SINK;
else if (message->src == GST_OBJECT (self->rtcp_src))
element_id = EL_RTCP_SRC;
else if (message->src == GST_OBJECT (self->rtcp_sink))
element_id = EL_RTCP_SINK;
else if (message->src == GST_OBJECT (self->rtcp_src))
element_id = EL_RTCP_SRC;
else if (message->src == GST_OBJECT (self->rtcp_sink))
element_id = EL_RTCP_SINK;
/* TODO srtp encryption
else if (message->src == GST_OBJECT (self->srtpenc))
element_id = EL_SRTP_ENCODER;
else if (message->src == GST_OBJECT (self->srtpdec))
element_id = EL_SRTP_DECODER;
*/
/* TODO srtp encryption
else if (message->src == GST_OBJECT (self->srtpenc))
element_id = EL_SRTP_ENCODER;
else if (message->src == GST_OBJECT (self->srtpdec))
element_id = EL_SRTP_DECODER;
*/
else if (message->src == GST_OBJECT (self->audio_src))
element_id = EL_AUDIO_SRC;
else if (message->src == GST_OBJECT (self->audio_sink))
element_id = EL_AUDIO_SINK;
else if (message->src == GST_OBJECT (self->audio_src))
element_id = EL_AUDIO_SRC;
else if (message->src == GST_OBJECT (self->audio_sink))
element_id = EL_AUDIO_SINK;
else if (message->src == GST_OBJECT (self->payloader))
element_id = EL_PAYLOADER;
else if (message->src == GST_OBJECT (self->depayloader))
element_id = EL_DEPAYLOADER;
else if (message->src == GST_OBJECT (self->payloader))
element_id = EL_PAYLOADER;
else if (message->src == GST_OBJECT (self->depayloader))
element_id = EL_DEPAYLOADER;
else if (message->src == GST_OBJECT (self->encoder))
element_id = EL_ENCODER;
else if (message->src == GST_OBJECT (self->decoder))
element_id = EL_DECODER;
else if (message->src == GST_OBJECT (self->encoder))
element_id = EL_ENCODER;
else if (message->src == GST_OBJECT (self->decoder))
element_id = EL_DECODER;
unset_element_id = G_MAXUINT ^ element_id;
unset_element_id = G_MAXUINT ^ element_id;
if (newstate == GST_STATE_PLAYING) {
self->element_map_playing |= element_id;
self->element_map_paused &= unset_element_id;
self->element_map_stopped &= unset_element_id;
} else if (newstate == GST_STATE_PAUSED) {
self->element_map_paused |= element_id;
self->element_map_playing &= unset_element_id;
self->element_map_stopped &= unset_element_id;
} else if (newstate == GST_STATE_NULL) {
self->element_map_stopped |= element_id;
self->element_map_playing &= unset_element_id;
self->element_map_paused &= unset_element_id;
}
check_element_maps (self);
break;
if (newstate == GST_STATE_PLAYING) {
self->element_map_playing |= element_id;
self->element_map_paused &= unset_element_id;
self->element_map_stopped &= unset_element_id;
} else if (newstate == GST_STATE_PAUSED) {
self->element_map_paused |= element_id;
self->element_map_playing &= unset_element_id;
self->element_map_stopped &= unset_element_id;
} else if (newstate == GST_STATE_NULL) {
self->element_map_stopped |= element_id;
self->element_map_playing &= unset_element_id;
self->element_map_paused &= unset_element_id;
}
check_element_maps (self);
break;
}
default:
if (self->debug)
g_debug ("Got unhandled %s message", GST_MESSAGE_TYPE_NAME (message));
@@ -584,7 +584,7 @@ pipeline_link_elements (CallsSipMediaPipeline *self,
gst_object_unref (sinkpad);
srcpad = gst_element_get_static_pad (self->rtcp_src, "src");
#if GST_CHECK_VERSION (1, 20 , 0)
#if GST_CHECK_VERSION (1, 20, 0)
sinkpad = gst_element_request_pad_simple (self->rtpbin, "recv_rtcp_sink_0");
#else
sinkpad = gst_element_get_request_pad (self->rtpbin, "recv_rtcp_sink_0");
@@ -596,21 +596,21 @@ pipeline_link_elements (CallsSipMediaPipeline *self,
return FALSE;
}
gst_object_unref (srcpad);
gst_object_unref (sinkpad);
gst_object_unref (srcpad);
gst_object_unref (sinkpad);
#if GST_CHECK_VERSION (1, 20, 0)
srcpad = gst_element_request_pad_simple (self->rtpbin, "send_rtcp_src_0");
srcpad = gst_element_request_pad_simple (self->rtpbin, "send_rtcp_src_0");
#else
srcpad = gst_element_get_request_pad (self->rtpbin, "send_rtcp_src_0");
srcpad = gst_element_get_request_pad (self->rtpbin, "send_rtcp_src_0");
#endif
sinkpad = gst_element_get_static_pad (self->rtcp_sink, "sink");
if (gst_pad_link (srcpad, sinkpad) != GST_PAD_LINK_OK) {
if (error)
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
"Failed to link rtpbin to rtcpsink");
return FALSE;
}
sinkpad = gst_element_get_static_pad (self->rtcp_sink, "sink");
if (gst_pad_link (srcpad, sinkpad) != GST_PAD_LINK_OK) {
if (error)
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
"Failed to link rtpbin to rtcpsink");
return FALSE;
}
/* can only link to depayloader after RTP payload has been verified */
g_signal_connect (self->rtpbin, "pad-added", G_CALLBACK (on_pad_added), self->depayloader);
@@ -966,8 +966,7 @@ diagnose_ports_in_use (CallsSipMediaPipeline *self)
if (same_socket) {
g_debug ("Diagnosing bidirectional socket...");
diagnose_used_ports_in_socket (socket_in);
}
else {
} else {
g_debug ("Diagnosing server socket...");
diagnose_used_ports_in_socket (socket_in);
g_debug ("Diagnosing client socket...");

View File

@@ -82,47 +82,46 @@ static GParamSpec *props[PROP_LAST_PROP];
static gboolean set_contact_header = FALSE;
struct _CallsSipOrigin
{
GObject parent_instance;
struct _CallsSipOrigin {
GObject parent_instance;
CallsSipContext *ctx;
nua_t *nua;
CallsSipHandles *oper;
char *contact_header; /* Needed for sofia SIP >= 1.13 */
CallsSipContext *ctx;
nua_t *nua;
CallsSipHandles *oper;
char *contact_header; /* Needed for sofia SIP >= 1.13 */
/* Direct connection mode is useful for debugging purposes */
gboolean use_direct_connection;
gboolean use_direct_connection;
/* Needed to handle shutdown correctly. See sip_callback and dispose method */
gboolean is_nua_shutdown;
gboolean is_shutdown_success;
gboolean is_nua_shutdown;
gboolean is_shutdown_success;
CallsAccountState state;
CallsAccountState state;
CallsSipMediaManager *media_manager;
/* Account information */
char *host;
char *user;
char *password;
char *display_name;
gint port;
char *transport_protocol;
gboolean auto_connect;
gboolean direct_mode;
gboolean can_tel;
char *host;
char *user;
char *password;
char *display_name;
gint port;
char *transport_protocol;
gboolean auto_connect;
gboolean direct_mode;
gboolean can_tel;
char *own_ip;
gint local_port;
char *own_ip;
gint local_port;
const char *protocol_prefix;
char *address;
char *name;
char *id;
const char *protocol_prefix;
char *address;
char *name;
char *id;
GList *calls;
GHashTable *call_handles;
GList *calls;
GHashTable *call_handles;
};
static void calls_sip_origin_message_source_interface_init (CallsOriginInterface *iface);
@@ -138,9 +137,9 @@ G_DEFINE_TYPE_WITH_CODE (CallsSipOrigin, calls_sip_origin, G_TYPE_OBJECT,
calls_sip_origin_accounts_interface_init))
static void
change_state (CallsSipOrigin *self,
CallsAccountState new_state,
CallsAccountStateReason reason)
change_state (CallsSipOrigin *self,
CallsAccountState new_state,
CallsAccountStateReason reason)
{
CallsAccountState old_state;
@@ -160,7 +159,7 @@ change_state (CallsSipOrigin *self,
static void
remove_call (CallsSipOrigin *self,
CallsCall *call,
const gchar *reason)
const char *reason)
{
CallsOrigin *origin;
CallsSipCall *sip_call;
@@ -188,7 +187,7 @@ remove_call (CallsSipOrigin *self,
static void
remove_calls (CallsSipOrigin *self,
const gchar *reason)
const char *reason)
{
CallsCall *call;
GList *next;
@@ -229,18 +228,19 @@ on_call_state_changed (CallsSipCall *call,
static void
add_call (CallsSipOrigin *self,
const gchar *address,
const char *address,
gboolean inbound,
nua_handle_t *handle)
{
CallsSipCall *sip_call;
CallsCall *call;
CallsSipMediaPipeline *pipeline;
g_autofree gchar *local_sdp = NULL;
g_auto (GStrv) address_split = NULL;
const char *call_address = address;
gint rtp_port, rtcp_port;
g_auto (GStrv) address_split = NULL;
g_autofree char *local_sdp = NULL;
pipeline = calls_sip_media_manager_get_pipeline (self->media_manager);
rtp_port = calls_sip_media_pipeline_get_rtp_port (pipeline);
rtcp_port = calls_sip_media_pipeline_get_rtcp_port (pipeline);
@@ -299,7 +299,7 @@ add_call (CallsSipOrigin *self,
static void
dial (CallsOrigin *origin,
const gchar *address)
const char *address)
{
CallsSipOrigin *self;
nua_handle_t *nh;
@@ -354,7 +354,7 @@ dial (CallsOrigin *origin,
static void
create_inbound (CallsSipOrigin *self,
const gchar *address,
const char *address,
nua_handle_t *handle)
{
g_assert (CALLS_IS_SIP_ORIGIN (self));
@@ -375,9 +375,9 @@ sip_authenticate (CallsSipOrigin *self,
nua_handle_t *nh,
sip_t const *sip)
{
const gchar *scheme = NULL;
const gchar *realm = NULL;
g_autofree gchar *auth = NULL;
const char *scheme = NULL;
const char *realm = NULL;
g_autofree char *auth = NULL;
sip_www_authenticate_t *www_auth = sip->sip_www_authenticate;
sip_proxy_authenticate_t *proxy_auth = sip->sip_proxy_authenticate;
@@ -412,20 +412,20 @@ sip_r_invite (int status,
sip_t const *sip,
tagi_t tags[])
{
g_debug ("response to outgoing INVITE: %03d %s", status, phrase);
g_debug ("response to outgoing INVITE: %03d %s", status, phrase);
/* TODO call states (see i_state) */
if (status == 401 || status == 407) {
sip_authenticate (origin, nh, sip);
} else if (status == 403) {
g_warning ("Response to outgoing INVITE: 403 wrong credentials?");
} else if (status == 904) {
g_warning ("Response to outgoing INVITE: 904 unmatched challenge."
"Possibly the challenge was already answered?");
} else if (status == 180) {
} else if (status == 100) {
} else if (status == 200) {
}
/* TODO call states (see i_state) */
if (status == 401 || status == 407) {
sip_authenticate (origin, nh, sip);
} else if (status == 403) {
g_warning ("Response to outgoing INVITE: 403 wrong credentials?");
} else if (status == 904) {
g_warning ("Response to outgoing INVITE: 904 unmatched challenge."
"Possibly the challenge was already answered?");
} else if (status == 180) {
} else if (status == 100) {
} else if (status == 200) {
}
}
@@ -446,7 +446,7 @@ sip_r_register (int status,
change_state (origin,
CALLS_ACCOUNT_STATE_ONLINE,
CALLS_ACCOUNT_STATE_REASON_CONNECTED);
nua_get_params (nua, TAG_ANY (), TAG_END());
nua_get_params (nua, TAG_ANY (), TAG_END ());
if (sip->sip_contact && sip->sip_contact->m_url && sip->sip_contact->m_url->url_host) {
g_free (origin->own_ip);
@@ -591,7 +591,7 @@ sip_i_state (int status,
rtcp_port = rtp_port + 1;
calls_sip_call_setup_remote_media_connection (call,
media_ip ? : session_ip,
media_ip ?: session_ip,
rtp_port,
rtcp_port);
}
@@ -675,7 +675,7 @@ sip_callback (nua_event_t event,
{
CallsSipOrigin *origin = CALLS_SIP_ORIGIN (magic);
CallsSipHandles *op = origin->oper;
g_autofree gchar * from = NULL;
g_autofree char *from = NULL;
switch (event) {
case nua_i_invite:
@@ -807,14 +807,13 @@ sip_callback (nua_event_t event,
if (status == 200) {
origin->is_nua_shutdown = TRUE;
origin->is_shutdown_success = TRUE;
}
else if (status == 500) {
} else if (status == 500) {
origin->is_nua_shutdown = TRUE;
origin->is_shutdown_success = FALSE;
}
break;
/* Deprecated events */
/* Deprecated events */
case nua_i_active:
break;
case nua_i_terminated:
@@ -827,7 +826,7 @@ sip_callback (nua_event_t event,
status,
phrase);
g_warning ("printing tags");
tl_print(stdout, "", tags);
tl_print (stdout, "", tags);
break;
}
}
@@ -1168,6 +1167,7 @@ supports_protocol (CallsOrigin *origin,
const char *protocol)
{
CallsSipOrigin *self;
g_assert (protocol);
g_assert (CALLS_IS_SIP_ORIGIN (origin));
@@ -1276,10 +1276,10 @@ calls_sip_origin_set_property (GObject *object,
static void
calls_sip_origin_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec)
calls_sip_origin_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec)
{
CallsSipOrigin *self = CALLS_SIP_ORIGIN (object);
g_autofree char *name = NULL;
@@ -1360,6 +1360,7 @@ static void
calls_sip_origin_constructed (GObject *object)
{
CallsSipOrigin *self = CALLS_SIP_ORIGIN (object);
g_autoptr (GError) error = NULL;
int major = 0;
int minor = 0;
@@ -1501,7 +1502,7 @@ calls_sip_origin_class_init (CallsSipOriginClass *klass)
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
g_object_class_install_property (object_class, PROP_ACC_LOCAL_PORT, props[PROP_ACC_LOCAL_PORT]);
props[PROP_SIP_CONTEXT] =
props[PROP_SIP_CONTEXT] =
g_param_spec_pointer ("sip-context",
"SIP context",
"The SIP context (sofia) used for our sip handles",

View File

@@ -32,14 +32,14 @@ G_BEGIN_DECLS
G_DECLARE_FINAL_TYPE (CallsSipOrigin, calls_sip_origin, CALLS, SIP_ORIGIN, GObject)
void calls_sip_origin_set_credentials (CallsSipOrigin *self,
const char *host,
const char *user,
const char *password,
const char *display_name,
const char *transport_protocol,
gint port,
gboolean use_for_tel,
gboolean auto_connect);
void calls_sip_origin_set_credentials (CallsSipOrigin *self,
const char *host,
const char *user,
const char *password,
const char *display_name,
const char *transport_protocol,
gint port,
gboolean use_for_tel,
gboolean auto_connect);
G_END_DECLS

View File

@@ -65,17 +65,16 @@ enum {
};
static GParamSpec *props[PROP_LAST_PROP];
struct _CallsSipProvider
{
CallsProvider parent_instance;
struct _CallsSipProvider {
CallsProvider parent_instance;
GListStore *origins;
GListStore *origins;
/* SIP */
CallsSipContext *ctx;
SipEngineState sip_state;
CallsSipContext *ctx;
SipEngineState sip_state;
gboolean use_memory_backend;
gchar *filename;
gboolean use_memory_backend;
gchar *filename;
CallsSipAccountWidget *account_widget;
};
@@ -86,20 +85,20 @@ static void calls_sip_provider_account_provider_interface_init (CallsAccountProv
#ifdef FOR_TESTING
G_DEFINE_TYPE_WITH_CODE
(CallsSipProvider, calls_sip_provider, CALLS_TYPE_PROVIDER,
G_IMPLEMENT_INTERFACE (CALLS_TYPE_MESSAGE_SOURCE,
calls_sip_provider_message_source_interface_init)
G_IMPLEMENT_INTERFACE (CALLS_TYPE_ACCOUNT_PROVIDER,
calls_sip_provider_account_provider_interface_init))
(CallsSipProvider, calls_sip_provider, CALLS_TYPE_PROVIDER,
G_IMPLEMENT_INTERFACE (CALLS_TYPE_MESSAGE_SOURCE,
calls_sip_provider_message_source_interface_init)
G_IMPLEMENT_INTERFACE (CALLS_TYPE_ACCOUNT_PROVIDER,
calls_sip_provider_account_provider_interface_init))
#else
G_DEFINE_DYNAMIC_TYPE_EXTENDED
(CallsSipProvider, calls_sip_provider, CALLS_TYPE_PROVIDER, 0,
G_IMPLEMENT_INTERFACE_DYNAMIC (CALLS_TYPE_MESSAGE_SOURCE,
calls_sip_provider_message_source_interface_init)
G_IMPLEMENT_INTERFACE_DYNAMIC (CALLS_TYPE_ACCOUNT_PROVIDER,
calls_sip_provider_account_provider_interface_init))
(CallsSipProvider, calls_sip_provider, CALLS_TYPE_PROVIDER, 0,
G_IMPLEMENT_INTERFACE_DYNAMIC (CALLS_TYPE_MESSAGE_SOURCE,
calls_sip_provider_message_source_interface_init)
G_IMPLEMENT_INTERFACE_DYNAMIC (CALLS_TYPE_ACCOUNT_PROVIDER,
calls_sip_provider_account_provider_interface_init))
#endif /* FOR_TESTING */
@@ -115,6 +114,7 @@ on_origin_pw_looked_up (GObject *source,
gpointer user_data)
{
SipOriginLoadData *data;
g_autoptr (GError) error = NULL;
g_autofree char *id = NULL;
g_autofree char *name = NULL;
@@ -367,7 +367,7 @@ calls_sip_provider_get_origins (CallsProvider *provider)
return G_LIST_MODEL (self->origins);
}
static const char * const *
static const char *const *
calls_sip_provider_get_protocols (CallsProvider *provider)
{
return supported_protocols;
@@ -397,7 +397,7 @@ calls_sip_provider_deinit_sip (CallsSipProvider *self)
}
g_clear_pointer (&self->ctx, g_free);
bail:
bail:
self->sip_state = SIP_ENGINE_NULL;
g_object_notify_by_pspec (G_OBJECT (self), props[PROP_SIP_STATE]);
}
@@ -448,7 +448,7 @@ calls_sip_provider_init_sofia (CallsSipProvider *self,
g_object_notify_by_pspec (G_OBJECT (self), props[PROP_SIP_STATE]);
return TRUE;
err:
err:
self->sip_state = SIP_ENGINE_ERROR;
g_object_notify_by_pspec (G_OBJECT (self), props[PROP_SIP_STATE]);
return FALSE;
@@ -456,10 +456,10 @@ calls_sip_provider_init_sofia (CallsSipProvider *self,
static void
calls_sip_provider_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec)
calls_sip_provider_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec)
{
CallsSipProvider *self = CALLS_SIP_PROVIDER (object);
@@ -479,6 +479,7 @@ static void
calls_sip_provider_constructed (GObject *object)
{
CallsSipProvider *self = CALLS_SIP_PROVIDER (object);
g_autoptr (GError) error = NULL;
const gchar *env_sip_test;
@@ -500,7 +501,7 @@ calls_sip_provider_constructed (GObject *object)
g_warning ("Could not initialize sofia stack: %s", error->message);
}
out:
out:
G_OBJECT_CLASS (calls_sip_provider_parent_class)->constructed (object);
}

View File

@@ -37,35 +37,35 @@ G_BEGIN_DECLS
G_DECLARE_FINAL_TYPE (CallsSipProvider, calls_sip_provider, CALLS, SIP_PROVIDER, CallsProvider)
CallsSipProvider *calls_sip_provider_new (void);
CallsSipOrigin *calls_sip_provider_add_origin (CallsSipProvider *self,
const char *id,
const char *host,
const char *user,
const char *password,
const char *display_name,
const char *transport_protocol,
gint port,
gboolean store_credentials);
CallsSipOrigin *calls_sip_provider_add_origin_full (CallsSipProvider *self,
const char *id,
const char *host,
const char *user,
const char *password,
const char *display_name,
const char *transport_protocol,
gint port,
gboolean auto_connect,
gboolean direct_mode,
gint local_port,
gboolean use_for_tel,
gboolean store_credentials);
gboolean calls_sip_provider_remove_origin (CallsSipProvider *self,
CallsSipOrigin *origin);
void calls_sip_provider_load_accounts (CallsSipProvider *self,
GKeyFile *key_file);
void calls_sip_provider_save_accounts (CallsSipProvider *self,
GKeyFile *key_file);
gboolean calls_sip_provider_save_accounts_to_disk (CallsSipProvider *self);
void peas_register_types (PeasObjectModule *module);
CallsSipOrigin *calls_sip_provider_add_origin (CallsSipProvider *self,
const char *id,
const char *host,
const char *user,
const char *password,
const char *display_name,
const char *transport_protocol,
gint port,
gboolean store_credentials);
CallsSipOrigin *calls_sip_provider_add_origin_full (CallsSipProvider *self,
const char *id,
const char *host,
const char *user,
const char *password,
const char *display_name,
const char *transport_protocol,
gint port,
gboolean auto_connect,
gboolean direct_mode,
gint local_port,
gboolean use_for_tel,
gboolean store_credentials);
gboolean calls_sip_provider_remove_origin (CallsSipProvider *self,
CallsSipOrigin *origin);
void calls_sip_provider_load_accounts (CallsSipProvider *self,
GKeyFile *key_file);
void calls_sip_provider_save_accounts (CallsSipProvider *self,
GKeyFile *key_file);
gboolean calls_sip_provider_save_accounts_to_disk (CallsSipProvider *self);
void peas_register_types (PeasObjectModule *module);
G_END_DECLS

View File

@@ -58,6 +58,6 @@ gboolean
protocol_is_valid (const char *protocol)
{
return g_strcmp0 (protocol, "UDP") == 0 ||
g_strcmp0 (protocol, "TCP") == 0 ||
g_strcmp0 (protocol, "TLS") == 0;
g_strcmp0 (protocol, "TCP") == 0 ||
g_strcmp0 (protocol, "TLS") == 0;
}

View File

@@ -28,17 +28,15 @@
#include <sofia-sip/nua.h>
#include <glib-object.h>
typedef struct
{
su_home_t home[1];
su_root_t *root;
typedef struct {
su_home_t home[1];
su_root_t *root;
} CallsSipContext;
typedef struct
{
nua_handle_t *register_handle;
nua_handle_t *call_handle;
CallsSipContext *context;
typedef struct {
nua_handle_t *register_handle;
nua_handle_t *call_handle;
CallsSipContext *context;
} CallsSipHandles;
@@ -49,16 +47,15 @@ typedef struct
* @SIP_ENGINE_ERROR: Unrecoverable/Unhandled sofia-sip error
* @SIP_ENGINE_READY: Ready for operation
*/
typedef enum
{
SIP_ENGINE_NULL = 0,
SIP_ENGINE_INITIALIZING,
SIP_ENGINE_ERROR,
SIP_ENGINE_READY,
} SipEngineState;
typedef enum {
SIP_ENGINE_NULL = 0,
SIP_ENGINE_INITIALIZING,
SIP_ENGINE_ERROR,
SIP_ENGINE_READY,
} SipEngineState;
gboolean check_sips (const char *addr);
gboolean check_ipv6 (const char *host);
const char *get_protocol_prefix (const char *protocol);
gboolean protocol_is_valid (const char *protocol);
gboolean check_sips (const char *addr);
gboolean check_ipv6 (const char *host);
const char *get_protocol_prefix (const char *protocol);
gboolean protocol_is_valid (const char *protocol);

View File

@@ -46,7 +46,8 @@ static MediaCodecInfo gst_codecs[] = {
* Returns: %TRUE if codec is available on your system, %FALSE otherwise
*/
gboolean
media_codec_available_in_gst (MediaCodecInfo *codec) {
media_codec_available_in_gst (MediaCodecInfo *codec)
{
gboolean available = FALSE;
GstRegistry *registry = gst_registry_get ();
GstPlugin *plugin = NULL;

View File

@@ -34,8 +34,8 @@
typedef struct {
guint payload_id;
char *name;
gint clock_rate;
gint channels;
gint clock_rate;
gint channels;
char *gst_payloader_name;
char *gst_depayloader_name;
char *gst_encoder_name;
@@ -44,8 +44,8 @@ typedef struct {
} MediaCodecInfo;
gboolean media_codec_available_in_gst (MediaCodecInfo *codec);
MediaCodecInfo* media_codec_by_name (const char *name);
MediaCodecInfo* media_codec_by_payload_id (uint payload_id);
gchar* media_codec_get_gst_capabilities (MediaCodecInfo *codec);
GList* media_codecs_get_candidates (void);
gboolean media_codec_available_in_gst (MediaCodecInfo *codec);
MediaCodecInfo *media_codec_by_name (const char *name);
MediaCodecInfo *media_codec_by_payload_id (uint payload_id);
gchar *media_codec_get_gst_capabilities (MediaCodecInfo *codec);
GList *media_codecs_get_candidates (void);