Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jami-daemon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
jami-daemon
Commits
dd132c86
Commit
dd132c86
authored
3 years ago
by
Olivier Dion
Committed by
Adrien Béraud
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
agent/agent: Add agent helper
Change-Id: I0c44b1a5fdd9727a8acf3d9deb88f9c2b5f71dd8
parent
877f8cd2
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/agent/agent.scm
+69
-0
69 additions, 0 deletions
test/agent/agent.scm
with
69 additions
and
0 deletions
test/agent/agent.scm
0 → 100644
+
69
−
0
View file @
dd132c86
;; Copyright (C) 2021 Savoir-faire Linux Inc.
;; Author: Olivier Dion <olivier.dion@savoirfairelinux.com>
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3 of the License, or
;; (at your option) any later version.
;; This program 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 General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program; if not, write to the Free Software
;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
(
define-module
(
agent
)
#
:use-module
(
ice-9
threads
)
#
:use-module
((
jami
account
)
#
:prefix
account:
)
#
:use-module
((
jami
call
)
#
:prefix
call:
)
#
:use-module
((
jami
signal
)
#
:prefix
jami:
))
(
define-public
account-id
"afafafafafafafaf"
)
(
define-public
peer-id
#f
)
(
define
(
wait-for-announcement-of%
accounts
)
(
let
((
mtx
(
make-mutex
))
(
cnd
(
make-condition-variable
)))
(
map
(
lambda
(
this-account
)
(
jami:on-signal
'volatile-details-changed
(
lambda
(
accountID
details
)
(
cond
((
not
(
string=
accountID
this-account
))
#f
)
((
not
(
string=
"true"
(
assoc-ref
details
"Account.deviceAnnounced"
)))
#f
)
(
else
(
with-mutex
mtx
(
signal-condition-variable
cnd
))
#t
))))
(
with-mutex
mtx
(
wait-condition-variable
cnd
mtx
)))
accounts
)))
(
define
(
wait-for-announcement-of
accounts
)
(
if
(
string?
accounts
)
(
wait-for-announcement-of%
(
list
accounts
))
(
wait-for-announcement-of%
accounts
)))
(
define-public
(
ensure-account
)
(
when
(
null?
(
account:get-details
account-id
))
(
account:add
'
((
"Account.type"
.
"RING"
)
(
"Account.displayName"
.
"AGENT"
)
(
"Account.alias"
.
"AGENT"
)
(
"Account.archivePassword"
.
""
)
(
"Account.archivePIN"
.
""
)
(
"Account.archivePath"
.
""
))
account-id
))
(
let
((
result
(
wait-for-announcement-of
account-id
)))
(
display
result
)
(
newline
)
(
unless
(
car
result
)
(
format
#t
"Timeout while waiting for account announcement~%"
)))
(
let
((
details
(
account:get-details
account-id
)))
(
set!
peer-id
(
assoc-ref
details
"Account.username"
))))
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment