From b65146fed3f258a9c927eee1ac0c2178a16c069e Mon Sep 17 00:00:00 2001
From: Olivier Dion <olivier.dion@savoirfairelinux.com>
Date: Thu, 9 Dec 2021 10:54:12 -0500
Subject: [PATCH] agent/bindings/account: Add add-contact, remove-contact
 bindings

Change-Id: I2fca281e9144d06243ca09879a1d86551ccd1996
---
 test/agent/src/bindings/account.h | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/test/agent/src/bindings/account.h b/test/agent/src/bindings/account.h
index b9a26004a1..83627ef27e 100644
--- a/test/agent/src/bindings/account.h
+++ b/test/agent/src/bindings/account.h
@@ -125,6 +125,30 @@ subscribe_buddy_binding(SCM accountID_str, SCM peer_uri_str, SCM flag_bool)
     return SCM_UNDEFINED;
 }
 
+static SCM
+add_contact_binding(SCM accountID_str, SCM uri_str)
+{
+    LOG_BINDING();
+
+    DRing::addContact(from_guile(accountID_str),
+                      from_guile(uri_str));
+
+    return SCM_UNDEFINED;
+}
+
+static SCM
+remove_contact_binding(SCM accountID_str, SCM uri_str, SCM ban_optional_bool)
+{
+    LOG_BINDING();
+
+    DRing::removeContact(from_guile(accountID_str),
+                         from_guile(uri_str),
+                         from_guile(ban_optional_bool));
+
+    return SCM_UNDEFINED;
+}
+
+
 static void
 install_account_primitives(void *)
 {
@@ -133,6 +157,8 @@ install_account_primitives(void *)
     define_primitive("send-register", 2, 0, 0, (void*) send_register_binding);
     define_primitive("account->archive", 2, 1, 0, (void*) export_to_file_binding);
     define_primitive("add", 1, 1, 0, (void*) add_account_binding);
+    define_primitive("add-contact", 2, 0, 0, (void*) add_contact_binding);
+    define_primitive("remove-contact", 2, 1, 0, (void*) remove_contact_binding);
     define_primitive("accept-trust-request", 2, 0, 0, (void*) accept_trust_request_binding);
     define_primitive("send-trust-request", 2, 1, 0, (void*) send_trust_request_binding);
     define_primitive("get-contacts", 1, 0, 0, (void*) get_contacts_binding);
-- 
GitLab