Port MatrixEventCallHangup to C

This commit is contained in:
Gergely Polonkai 2017-11-21 14:12:14 +01:00
parent dcf8856d24
commit b5de83be3c
6 changed files with 104 additions and 21 deletions

1
.gitignore vendored
View File

@ -62,5 +62,4 @@ Makefile.in
/src/matrix-event-room-third-party-invite.c /src/matrix-event-room-third-party-invite.c
/src/matrix-event-call-invite.c /src/matrix-event-call-invite.c
/src/matrix-event-call-candidates.c /src/matrix-event-call-candidates.c
/src/matrix-event-call-hangup.c
/src/matrix-glib-0.0.pc /src/matrix-glib-0.0.pc

View File

@ -30,7 +30,6 @@ libmatrix_glib_0_0_la_VALA_SOURCES = \
matrix-event-room-third-party-invite.vala \ matrix-event-room-third-party-invite.vala \
matrix-event-call-invite.vala \ matrix-event-call-invite.vala \
matrix-event-call-candidates.vala \ matrix-event-call-candidates.vala \
matrix-event-call-hangup.vala \
$(NULL) $(NULL)
AM_CPPFLAGS += \ AM_CPPFLAGS += \
@ -89,6 +88,7 @@ INST_H_SRC_FILES = \
matrix-event-base.h \ matrix-event-base.h \
matrix-event-call-base.h \ matrix-event-call-base.h \
matrix-event-call-answer.h \ matrix-event-call-answer.h \
matrix-event-call-hangup.h \
matrix-message-base.h \ matrix-message-base.h \
matrix-message-text.h \ matrix-message-text.h \
matrix-message-location.h \ matrix-message-location.h \
@ -138,6 +138,7 @@ libmatrix_glib_0_0_la_SOURCES = \
matrix-event-base.c \ matrix-event-base.c \
matrix-event-call-base.c \ matrix-event-call-base.c \
matrix-event-call-answer.c \ matrix-event-call-answer.c \
matrix-event-call-hangup.c \
matrix-message-base.c \ matrix-message-base.c \
matrix-message-text.c \ matrix-message-text.c \
matrix-message-location.c \ matrix-message-location.c \

View File

@ -0,0 +1,73 @@
/*
* This file is part of matrix-glib-sdk
*
* matrix-glib-sdk is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either
* version 3 of the License, or (at your option) any later version.
*
* matrix-glib-sdk is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with matrix-glib-sdk. If not, see
* <http://www.gnu.org/licenses/>.
*/
#include "matrix-event-call-hangup.h"
/**
* SECTION:matrix-event-call-hangup
* @short_description: event to signal that a calling party has hung up the line
*
* This event is sent by either party to signal their termination of the call. This can be
* sent either once the call has has been established or before to abort the call.
*/
/**
* MatrixEventCallHangup:
*
*/
G_DEFINE_TYPE(MatrixEventCallHangup, matrix_event_call_hangup, MATRIX_EVENT_TYPE_CALL);
static void
matrix_event_call_hangup_real_from_json(MatrixEventBase *matrix_event_base, JsonNode *json_data, GError **error)
{
g_return_if_fail(json_data != NULL);
MATRIX_EVENT_BASE_CLASS(matrix_event_call_hangup_parent_class)->from_json(matrix_event_base, json_data, error);
}
static void
matrix_event_call_hangup_real_to_json(MatrixEventBase *matrix_event_base, JsonNode *json_data, GError **error)
{
g_return_if_fail(json_data != NULL);
MATRIX_EVENT_BASE_CLASS(matrix_event_call_hangup_parent_class)->to_json(matrix_event_base, json_data, error);
}
/**
* matrix_event_call_hangup_new:
*
* Create a new #MatrixEventCallHangup object.
*
* Returns: (transfer full): a new #MatrixEventCallHangup object
*/
MatrixEventCallHangup *
matrix_event_call_hangup_new(void)
{
return (MatrixEventCallHangup *)matrix_event_call_construct(MATRIX_EVENT_TYPE_CALL_HANGUP);
}
static void
matrix_event_call_hangup_class_init(MatrixEventCallHangupClass *klass)
{
((MatrixEventBaseClass *)klass)->from_json = matrix_event_call_hangup_real_from_json;
((MatrixEventBaseClass *)klass)->to_json = matrix_event_call_hangup_real_to_json;
}
static void
matrix_event_call_hangup_init(MatrixEventCallHangup *matrix_event_call_hangup)
{}

View File

@ -16,23 +16,23 @@
* <http://www.gnu.org/licenses/>. * <http://www.gnu.org/licenses/>.
*/ */
/** #ifndef __MATRIX_GLIB_SDK_EVENT_CALL_HANGUP_H__
* Sent by either party to signal their termination of the call. This # define __MATRIX_GLIB_SDK_EVENT_CALL_HANGUP_H__
* can be sent either once the call has has been established or before
* to abort the call.
*/
public class Matrix.Event.CallHangup : Matrix.Event.Call {
protected override void
from_json(Json.Node json_data)
throws Matrix.Error
{
base.from_json(json_data);
}
protected override void # include <glib-object.h>
to_json(Json.Node json_data) # include "matrix-event-call-base.h"
throws Matrix.Error
{ G_BEGIN_DECLS
base.to_json(json_data);
} # define MATRIX_EVENT_TYPE_CALL_HANGUP matrix_event_call_hangup_get_type()
} G_DECLARE_DERIVABLE_TYPE(MatrixEventCallHangup, matrix_event_call_hangup, MATRIX_EVENT, CALL_HANGUP, MatrixEventCall)
struct _MatrixEventCallHangupClass {
MatrixEventCallClass parent_class;
};
MatrixEventCallHangup* matrix_event_call_hangup_new (void);
G_END_DECLS
#endif /* __MATRIX_GLIB_SDK_EVENT_CALL_HANGUP_H__ */

View File

@ -31,6 +31,7 @@
#include "matrix-event-room-history-visibility.h" #include "matrix-event-room-history-visibility.h"
#include "matrix-event-room-join-rules.h" #include "matrix-event-room-join-rules.h"
#include "matrix-event-call-answer.h" #include "matrix-event-call-answer.h"
#include "matrix-event-call-hangup.h"
#include "matrix-message-text.h" #include "matrix-message-text.h"
#include "matrix-message-location.h" #include "matrix-message-location.h"

View File

@ -752,6 +752,15 @@ namespace Matrix {
protected override void to_json(Json.Node json_data) protected override void to_json(Json.Node json_data)
throws Matrix.Error; throws Matrix.Error;
} }
[CCode (cheader_filename = "matrix-event-call-hangup.h")]
public class CallHangup : Call {
protected override void from_json(Json.Node json_data)
throws Matrix.Error;
protected override void to_json(Json.Node json_data)
throws Matrix.Error;
}
} }
[CCode (gir_namespace = "MatrixMessage", gir_version = "0.0")] [CCode (gir_namespace = "MatrixMessage", gir_version = "0.0")]