Skip to content

Commit 22274a8

Browse files
committed
e2e: Create MatrixE2EData type and matrix-e2e.[ch] files
Somewhere for the e2e magic to happen. Signed-off-by: Dr. David Alan Gilbert <[email protected]>
1 parent da5db06 commit 22274a8

File tree

4 files changed

+62
-0
lines changed

4 files changed

+62
-0
lines changed

Makefile.common

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ CFLAGS+=-DMATRIX_NO_E2E
1313
endif
1414

1515
OBJECTS = libmatrix.o matrix-api.o matrix-connection.o \
16+
matrix-e2e.o \
1617
matrix-event.o \
1718
matrix-json.o \
1819
matrix-room.o \

matrix-connection.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include <glib.h>
3030

3131
struct _PurpleConnection;
32+
struct _MatrixE2EData;
3233

3334
typedef struct _MatrixConnectionData {
3435
struct _PurpleConnection *pc;
@@ -38,6 +39,8 @@ typedef struct _MatrixConnectionData {
3839

3940
/* the active sync request */
4041
struct _MatrixApiRequestData *active_sync;
42+
/* All the end-2-end encryption magic */
43+
struct _MatrixE2EData *e2e;
4144
} MatrixConnectionData;
4245

4346

matrix-e2e.c

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/**
2+
* Matrix end-to-end encryption support
3+
*
4+
* This program is free software; you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation; either version 2 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU General Public License
15+
* along with this program; if not, write to the Free Software
16+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
17+
*/
18+
19+
#include <stdio.h>
20+
#include "libmatrix.h"
21+
#include "matrix-e2e.h"
22+
23+
#include "connection.h"
24+
#ifndef MATRIX_NO_E2E
25+
#include "olm/olm.h"
26+
27+
struct _MatrixE2EData {
28+
OlmAccount *oa;
29+
gchar *device_id;
30+
};
31+
32+
#else
33+
/* ==== Stubs for when e2e is configured out of the build === */
34+
#endif

matrix-e2e.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/**
2+
* Matrix end-to-end encryption support
3+
*
4+
* This program is free software; you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation; either version 2 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU General Public License
15+
* along with this program; if not, write to the Free Software
16+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
17+
*/
18+
19+
#ifndef MATRIX_E2E_H
20+
#define MATRIX_E2E_H
21+
22+
typedef struct _MatrixE2EData MatrixE2EData;
23+
24+
#endif

0 commit comments

Comments
 (0)