From d66edafb7dcba1eefc2484ba3db5ca66d69db637 Mon Sep 17 00:00:00 2001
From: Olivier Dion <olivier.dion@savoirfairelinux.com>
Date: Tue, 9 Nov 2021 13:13:00 -0500
Subject: [PATCH] agent/agent: Use parameter instead of fluid

Change-Id: I365b4346d123b0cc8c71a17e62e25bae37e5fc49
---
 test/agent/agent.scm                          | 30 +++++++++----------
 test/agent/examples/active-agent.scm          |  2 +-
 test/agent/examples/passive-agent.scm         |  4 +--
 .../agent/scenarios/peer-monitor/scenario.scm |  6 ++--
 4 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/test/agent/agent.scm b/test/agent/agent.scm
index 38877a50a3..4e16d9075f 100644
--- a/test/agent/agent.scm
+++ b/test/agent/agent.scm
@@ -25,8 +25,8 @@
   #:export (ensure-account
             ensure-account-from-archive))
 
-(define-public account-id (make-fluid "afafafafafafafaf"))
-(define-public peer-id (make-fluid))
+(define-public account-id (make-parameter "afafafafafafafaf"))
+(define-public peer-id (make-parameter #f))
 
 (define* (ensure-account% this-account-id account-details #:optional (wait-for-announcement? #t))
   (if wait-for-announcement?
@@ -51,24 +51,24 @@
         (account:add account-details this-account-id)))
 
   (let ((details (account:get-details this-account-id)))
-    (fluid-set! peer-id (assoc-ref details "Account.username"))))
+    (peer-id (assoc-ref details "Account.username"))))
 
 (define* (ensure-account #:key (wait-for-announcement? #t))
   (jami:info "Ensure account")
-  (ensure-account% (fluid-ref account-id) '(("Account.type"            . "RING")
-                                            ("Account.displayName"     . "AGENT")
-                                            ("Account.alias"           . "AGENT")
-                                            ("Account.archivePassword" . "")
-                                            ("Account.archivePIN"      . "")
-                                            ("Account.archivePath"     . ""))
+  (ensure-account% (account-id) '(("Account.type"            . "RING")
+                                  ("Account.displayName"     . "AGENT")
+                                  ("Account.alias"           . "AGENT")
+                                  ("Account.archivePassword" . "")
+                                  ("Account.archivePIN"      . "")
+                                  ("Account.archivePath"     . ""))
                    wait-for-announcement?))
 
 (define* (ensure-account-from-archive path #:key (wait-for-announcement? #t))
   (jami:info "Ensure account from archive ~a" path)
-  (ensure-account% (fluid-ref account-id) `(("Account.type"            . "RING")
-                                            ("Account.displayName"     . "AGENT")
-                                            ("Account.alias"           . "AGENT")
-                                            ("Account.archivePassword" . "")
-                                            ("Account.archivePIN"      . "")
-                                            ("Account.archivePath"     . ,path))
+  (ensure-account% (account-id) `(("Account.type"            . "RING")
+                                  ("Account.displayName"     . "AGENT")
+                                  ("Account.alias"           . "AGENT")
+                                  ("Account.archivePassword" . "")
+                                  ("Account.archivePIN"      . "")
+                                  ("Account.archivePath"     . ,path))
                    wait-for-announcement?))
diff --git a/test/agent/examples/active-agent.scm b/test/agent/examples/active-agent.scm
index 9b1e550301..0ba23daf53 100644
--- a/test/agent/examples/active-agent.scm
+++ b/test/agent/examples/active-agent.scm
@@ -52,7 +52,7 @@
 
 (agent:ensure-account)
 
-(let ((account (fluid-ref agent:account-id))
+(let ((account (agent:account-id))
       (peer "FIXME"))
 
   (when (string= peer "FIXME")
diff --git a/test/agent/examples/passive-agent.scm b/test/agent/examples/passive-agent.scm
index d5124a8a41..7e9befd227 100644
--- a/test/agent/examples/passive-agent.scm
+++ b/test/agent/examples/passive-agent.scm
@@ -10,9 +10,9 @@
 
 (agent:ensure-account)
 
-(jami:info "Agent peer-id: ~a" (fluid-ref agent:peer-id))
+(jami:info "Agent peer-id: ~a" (agent:peer-id))
 
-(let ((account (fluid-ref agent:account-id)))
+(let ((account (agent:account-id)))
   (jami:on-signal 'incoming-call/media
                   (lambda (account-id call-id peer media-lst)
                     (when (string= account-id account)
diff --git a/test/agent/scenarios/peer-monitor/scenario.scm b/test/agent/scenarios/peer-monitor/scenario.scm
index 6e4a985efa..04ff4c5c8c 100755
--- a/test/agent/scenarios/peer-monitor/scenario.scm
+++ b/test/agent/scenarios/peer-monitor/scenario.scm
@@ -65,7 +65,7 @@
 
                        (sigaction SIGALRM (lambda _ (setup-timer)))
 
-                       (let ((account (fluid-ref agent:account-id))
+                       (let ((account (agent:account-id))
                              (details (next-details!)))
                          (progress "SIGALRM - Changing account details: ~a" details)
                          (account:send-register account #f)
@@ -104,13 +104,13 @@
                                   #t))
                             #f)))
       (with-mutex mtx
-        (set! this-call-id (call:place-call (fluid-ref agent:account-id) peer))
+        (set! this-call-id (call:place-call (agent:account-id) peer))
         (let ((ret (wait-condition-variable cnd mtx
                                             (+ (current-time) timeout))))
           (unless ret (atomic-box-set! continue #f))
           ret))))
 
-  (let ((account (fluid-ref agent:account-id))
+  (let ((account (agent:account-id))
         (success 0)
         (failure 0)
         (reset (call/cc (lambda (k)
-- 
GitLab