1
- /**
2
- * Combadge-protocol, an implementation of an OEM Combadge control protocol for Spin Doctor
3
- * Copyright (C) 2021-2022 The Combadge Project by mo-g
4
- *
5
- * Combadge-protocol is free software: you can redistribute it and/or modify
6
- * it under the terms of the GNU Affero General Public License as published by
7
- * the Free Software Foundation, version 3 of the License.
8
- *
9
- * Combadge-protocol 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 Combadge-protocol. If not, see <https://www.gnu.org/licenses/>.
16
- */
17
-
18
- userTemplate = {
19
- userName : "u-fallbackuser" , // Globally unique ID
20
- fullName : new UserFullName ( foreName = "Fallback" , familyName = "User" , nickName = "Fallback User" ) ,
21
- ipaPronunciation : "fɔːlbæk ˈjuːzə" , // Not currently in use for STT or TTS but worth adding.
22
- associatedGroups : [ ] ,
23
-
24
- assignedBadge : "ba:dg:em:ac:ad:dr" , // Optional, for autologin/whitelisting
25
- personalTerminals : [ ] // Being vidcom terminals that can be used to make video calls.
26
- } ;
27
-
28
- groupTemplate = {
29
- groupName : "g-allhands" ,
30
- nickName : "All Hands" ,
31
- ipaPronunciation : "ɔːl hændz" , // Not currently in use for STT or TTS but worth adding.
32
- associatedUsers : [ ] ,
33
-
34
- assignedAddress : "Placeholder for multicast IPAddress Object"
35
- } ;
36
-
37
-
38
- /**
39
- * Frst pass. Probably want to restructure this to allow returning different form of name.
40
- *
41
- * Assume middle names to include patronyms. Should obviously be treated as an ordered list regardless.
42
- * Do we want to merge pronunciation in to this as well?
43
- */
44
- class UserFullName {
45
- constructor ( { prefix = "" , foreName = "" , middleNames = [ ] , familyName = "" , suffix = "" , nickName = "" } = { } ) {
46
- this . prefix = prefix ;
47
- this . foreName = foreName ;
48
- this . middleNames = middleNames ;
49
- this . familyName = familyName ;
50
- this . suffix = suffix ;
51
- this . nickName = nickName ;
52
-
53
- preferredFormat = this . fullName ;
54
- } ;
55
-
56
- fullName ( ) {
57
- var assembled = "" ;
58
- if ( this . prefix ) { assembled += this . prefix } ;
59
- if ( this . foreName ) { assembled += this . foreName } ;
60
- if ( this . middleNames ) {
61
- this . middleNames . forEach ( function ( name ) {
62
- assembled += name ;
63
- } ) ;
64
- } ;
65
- if ( this . familyName ) { assembled += this . familyName } ;
66
- if ( this . suffix ) { assembled += this . suffix } ;
67
-
68
- if ( assembled ) {
69
- return assembled ;
70
- } else {
71
- throw "Cannot stringify empty name."
72
- } ;
73
- } ;
74
-
75
- toString ( ) {
76
- return this . preferredFormat ( ) ;
77
- } ;
78
-
79
- }
80
-
81
- class User {
82
- constructor ( ) {
83
-
84
- } ;
85
- } ;
86
-
87
- class Group {
88
- constructor ( ) {
89
-
90
- } ;
91
- } ;
92
-
1
+ /**
2
+ * Spin Doctor, a Combadge Voice Server
3
+ * Copyright (C) 2021-2022 The Combadge Project by mo-g
4
+ *
5
+ * Spin Doctor is free software: you can redistribute it and/or modify
6
+ * it under the terms of the GNU Affero General Public License as published by
7
+ * the Free Software Foundation, version 3 of the License.
8
+ *
9
+ * Spin Doctor 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 Spin Doctor. If not, see <https://www.gnu.org/licenses/>.
16
+ */
17
+
18
+
19
+ /**
20
+ * User class describes a person who signs in to a Communicator. A User will
21
+ * have the following mandatory attributes:
22
+ * - username: a unique identifier. This will link a User object to it's source
23
+ * in the database, and will be derived from and associated to any directory.
24
+ * - name: The user's human-readable name as they or the directory records.
25
+ *
26
+ * Additionally, a User may have the following optional attributes:
27
+ * - presence: A representation of the presence state of the user. This could
28
+ * be offline, available, DND, in-call.
29
+ * - permittedContacts: A machine readable reference to the contacts permitted
30
+ * to contact this user. i.e. in SME, allow your secretary to contact the CEO
31
+ * but not the chaiwala. Should probably handle state-dependent logic - i.e.
32
+ * allow your partner to contact you in DND mode, but not your mother-in-law.
33
+ * - personalContacts: A store of the contacts that relate specifically to you.
34
+ * E.G. Your pharmacy, your work. This allows shorthands that wouldn't make
35
+ * sense when used by other people.
36
+ */
37
+
38
+ userTemplate = {
39
+ userName : "u-fallbackuser" , // Globally unique ID
40
+ fullName : new UserFullName ( foreName = "Fallback" , familyName = "User" , nickName = "Fallback User" ) ,
41
+ ipaPronunciation : "fɔːlbæk ˈjuːzə" , // Not currently in use for STT or TTS but worth adding.
42
+ associatedGroups : [ ] ,
43
+
44
+ assignedDevices : [ "ba:dg:em:ac:ad:dr" ] , // Optional, for autologin/whitelisting
45
+ personalTerminals : [ "te:rm:in:al:ma:cs" ] // Being vidcom terminals that can be used to make video calls.
46
+ } ;
47
+
48
+ groupTemplate = {
49
+ groupName : "g-allhands" ,
50
+ nickName : "All Hands" ,
51
+ ipaPronunciation : "ɔːl hændz" , // Not currently in use for STT or TTS but worth adding.
52
+ associatedUsers : [ ] ,
53
+
54
+ assignedAddress : "Placeholder for multicast IPAddress Object"
55
+ } ;
56
+
57
+
58
+ /**
59
+ * Frst pass. Probably want to restructure this to allow returning different form of name.
60
+ *
61
+ * Assume middle names to include patronyms. Should obviously be treated as an ordered list regardless.
62
+ * Do we want to merge pronunciation in to this as well?
63
+ */
64
+ class UserFullName {
65
+ constructor ( { prefix = "" , foreName = "" , middleNames = [ ] , familyName = "" , suffix = "" , nickName = "" } = { } ) {
66
+ this . prefix = prefix ;
67
+ this . foreName = foreName ;
68
+ this . middleNames = middleNames ;
69
+ this . familyName = familyName ;
70
+ this . suffix = suffix ;
71
+ this . nickName = nickName ;
72
+
73
+ preferredFormat = this . fullName ;
74
+ } ;
75
+
76
+ fullName ( ) {
77
+ var assembled = "" ;
78
+ if ( this . prefix ) { assembled += this . prefix } ;
79
+ if ( this . foreName ) { assembled += this . foreName } ;
80
+ if ( this . middleNames ) {
81
+ this . middleNames . forEach ( function ( name ) {
82
+ assembled += name ;
83
+ } ) ;
84
+ } ;
85
+ if ( this . familyName ) { assembled += this . familyName } ;
86
+ if ( this . suffix ) { assembled += this . suffix } ;
87
+
88
+ if ( assembled ) {
89
+ return assembled ;
90
+ } else {
91
+ throw "Cannot stringify empty name."
92
+ } ;
93
+ } ;
94
+
95
+ toString ( ) {
96
+ return this . preferredFormat ( ) ;
97
+ } ;
98
+
99
+ }
100
+
101
+ class User {
102
+ constructor ( ) {
103
+
104
+ } ;
105
+ } ;
106
+
107
+ class Group {
108
+ constructor ( ) {
109
+
110
+ } ;
111
+ } ;
112
+
93
113
export { User , Group } ;
0 commit comments