Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Evangelos Ribeiro Tzaras
chatty
Commits
b6adcd95
Commit
b6adcd95
authored
Jul 06, 2021
by
Mohammed Sadiq
Committed by
Mohammed Sadiq
Jul 06, 2021
Browse files
ma-account: Add API to delete 3pid
parent
a7bbbe46
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/matrix/chatty-ma-account.c
View file @
b6adcd95
...
...
@@ -1450,6 +1450,59 @@ chatty_ma_account_get_3pid_finish (ChattyMaAccount *self,
return
g_task_propagate_boolean
(
G_TASK
(
result
),
error
);
}
static
void
ma_delete_3pid_cb
(
GObject
*
object
,
GAsyncResult
*
result
,
gpointer
user_data
)
{
ChattyMaAccount
*
self
;
g_autoptr
(
GTask
)
task
=
user_data
;
GError
*
error
=
NULL
;
g_assert
(
G_IS_TASK
(
task
));
self
=
g_task_get_source_object
(
task
);
g_assert
(
CHATTY_IS_MA_ACCOUNT
(
self
));
matrix_api_delete_3pid_finish
(
self
->
matrix_api
,
result
,
&
error
);
if
(
error
)
g_task_return_error
(
task
,
error
);
else
g_task_return_boolean
(
task
,
TRUE
);
}
void
chatty_ma_account_delete_3pid_async
(
ChattyMaAccount
*
self
,
const
char
*
value
,
ChattyIdType
type
,
GCancellable
*
cancellable
,
GAsyncReadyCallback
callback
,
gpointer
user_data
)
{
GTask
*
task
=
NULL
;
g_return_if_fail
(
CHATTY_IS_MA_ACCOUNT
(
self
));
g_return_if_fail
(
!
cancellable
||
G_IS_CANCELLABLE
(
cancellable
));
task
=
g_task_new
(
self
,
cancellable
,
callback
,
user_data
);
matrix_api_delete_3pid_async
(
self
->
matrix_api
,
value
,
type
,
cancellable
,
ma_delete_3pid_cb
,
task
);
}
gboolean
chatty_ma_account_delete_3pid_finish
(
ChattyMaAccount
*
self
,
GAsyncResult
*
result
,
GError
**
error
)
{
g_return_val_if_fail
(
CHATTY_IS_MA_ACCOUNT
(
self
),
FALSE
);
g_return_val_if_fail
(
G_IS_TASK
(
result
),
FALSE
);
return
g_task_propagate_boolean
(
G_TASK
(
result
),
error
);
}
void
chatty_ma_account_add_chat
(
ChattyMaAccount
*
self
,
ChattyChat
*
chat
)
...
...
src/matrix/chatty-ma-account.h
View file @
b6adcd95
...
...
@@ -70,6 +70,15 @@ gboolean chatty_ma_account_get_3pid_finish (ChattyMaAccount *self,
GPtrArray
**
phones
,
GAsyncResult
*
result
,
GError
**
error
);
void
chatty_ma_account_delete_3pid_async
(
ChattyMaAccount
*
self
,
const
char
*
value
,
ChattyIdType
type
,
GCancellable
*
cancellable
,
GAsyncReadyCallback
callback
,
gpointer
user_data
);
gboolean
chatty_ma_account_delete_3pid_finish
(
ChattyMaAccount
*
self
,
GAsyncResult
*
result
,
GError
**
error
);
/* For tests */
void
chatty_ma_account_add_chat
(
ChattyMaAccount
*
self
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment