1
0
Fork 0
mirror of https://gitlab.gnome.org/GNOME/calls.git synced 2024-10-22 04:35:23 +00:00

call: Track which side hung up the call

Adding a boolean flag allows us to distinguish this from situations
where the other side ended the call.

Part-of: <https://gitlab.gnome.org/GNOME/calls/-/merge_requests/743>
This commit is contained in:
Guido Günther 2024-06-13 19:35:23 +02:00 committed by Marge Bot
parent 7bc0cc06ca
commit 7b2ab53f4d
2 changed files with 30 additions and 0 deletions

View file

@ -73,6 +73,7 @@ typedef struct {
gboolean inbound;
gboolean encrypted;
CallsCallType call_type;
gboolean hung_up;
} CallsCallPrivate;
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (CallsCall, calls_call, G_TYPE_OBJECT)
@ -511,7 +512,12 @@ calls_call_answer (CallsCall *self)
void
calls_call_hang_up (CallsCall *self)
{
CallsCallPrivate *priv;
g_return_if_fail (CALLS_IS_CALL (self));
priv = calls_call_get_instance_private (self);
priv->hung_up = TRUE;
CALLS_CALL_GET_CLASS (self)->hang_up (self);
}
@ -650,3 +656,22 @@ calls_call_set_encrypted (CallsCall *self,
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_ENCRYPTED]);
}
/**
* calls_call_get_we_hung_up:
* @self: The call
*
* Get whether we hung up or the remote side.
*
* Returns: `TRUE` if we hung up, otherwise `FALSE`
*/
gboolean
calls_call_get_we_hung_up (CallsCall *self)
{
CallsCallPrivate *priv;
g_return_val_if_fail (CALLS_IS_CALL (self), FALSE);
priv = calls_call_get_instance_private (self);
return priv->hung_up;
}

View file

@ -58,6 +58,10 @@ typedef enum {
CALLS_CALL_TYPE_SIP_VOICE,
} CallsCallType;
/**
* CallsCallClass:
* @hang_up: Called to hang up a call.
*/
struct _CallsCallClass {
GObjectClass parent_class;
@ -88,6 +92,7 @@ void calls_call_hang_up (CallsCall *self);
gboolean calls_call_can_dtmf (CallsCall *self);
void calls_call_send_dtmf_tone (CallsCall *self,
char key);
gboolean calls_call_get_we_hung_up (CallsCall *self);
gboolean calls_call_state_parse_nick (CallsCallState *state,
const char *nick);