1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
|
/*
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package net.java.sip.communicator.plugin.jabberaccregwizz;
import java.util.*;
import net.java.sip.communicator.service.protocol.*;
/**
* The <tt>JabberAccountRegistration</tt> is used to store all user input data
* through the <tt>JabberAccountRegistrationWizard</tt>.
*
* @author Yana Stamcheva
*/
public class JabberAccountRegistration
{
/**
* The default value of server port for jabber accounts.
*/
public static final String DEFAULT_PORT = "5222";
/**
* The default value of the priority property.
*/
public static final String DEFAULT_PRIORITY = "30";
/**
* The default value of the resource property.
*/
public static final String DEFAULT_RESOURCE = "jitsi";
/**
* The default value of stun server port for jabber accounts.
*/
public static final String DEFAULT_STUN_PORT = "3478";
/**
* Default value for resource auto generating.
*/
public static final boolean DEFAULT_RESOURCE_AUTOGEN = true;
/**
* The user identifier.
*/
private String userID;
/**
* The password.
*/
private String password;
/**
* Indicates if the password should be remembered.
*/
private boolean rememberPassword = true;
/**
* The server address.
*/
private String serverAddress;
/**
* The default domain.
*/
private String defaultUserSufix;
/**
* The override domain for phone call.
*
* If Jabber account is able to call PSTN number and if domain name of the
* switch is different than the domain of the account (gw.domain.org vs
* domain.org), you can use this property to set the switch domain.
*/
private String overridePhoneSuffix = null;
/**
* Always call with gtalk property.
*
* It is used to bypass capabilities checks: some softwares do not advertise
* GTalk support (but they support it).
*/
private boolean bypassGtalkCaps = false;
/**
* Domain name that will bypass GTalk caps.
*/
private String domainBypassCaps = null;
/**
* The port.
*/
private int port = new Integer(DEFAULT_PORT).intValue();
/**
* The resource property, initialized to the default resource.
*/
private String resource = DEFAULT_RESOURCE;
/**
* The priority property.
*/
private int priority = new Integer(DEFAULT_PRIORITY).intValue();
/**
* Indicates if keep alive packets should be send.
*/
private boolean sendKeepAlive = true;
/**
* Indicates if gmail notifications should be enabled.
*/
private boolean enableGmailNotification = false;
/**
* Indicates if Google Contacts should be enabled.
*/
private boolean enableGoogleContacts = false;
/**
* Indicates if ICE should be used.
*/
private boolean isUseIce = false;
/**
* Indicates if Google ICE should be used.
*/
private boolean isUseGoogleIce = false;
/**
* Indicates if STUN server should be automatically discovered.
*/
private boolean isAutoDiscoverStun = false;
/**
* Indicates if default STUN server should be used.
*/
private boolean isUseDefaultStunServer = false;
/**
* The list of additional STUN servers entered by user.
*/
private List<StunServerDescriptor> additionalStunServers
= new ArrayList<StunServerDescriptor>();
/**
* Indicates if JingleNodes relays should be used.
*/
private boolean isUseJingleNodes = false;
/**
* Indicates if JingleNodes relay server should be automatically discovered.
*/
private boolean isAutoDiscoverJingleNodes = false;
/**
* The list of additional JingleNodes (tracker or relay) entered by user.
*/
private List<JingleNodeDescriptor> additionalJingleNodes
= new ArrayList<JingleNodeDescriptor>();
/**
* Indicates if UPnP should be used.
*/
private boolean isUseUPNP = false;
/**
* Indicates if the server is overriden.
*/
private boolean isServerOverridden = false;
/**
* Is resource auto generate enabled.
*/
private boolean resourceAutogenerated = DEFAULT_RESOURCE_AUTOGEN;
/**
* Returns the password of the jabber registration account.
* @return the password of the jabber registration account.
*/
public String getPassword()
{
return password;
}
/**
* Sets the password of the jabber registration account.
* @param password the password of the jabber registration account.
*/
public void setPassword(String password)
{
this.password = password;
}
/**
* Returns TRUE if password has to remembered, FALSE otherwise.
* @return TRUE if password has to remembered, FALSE otherwise
*/
public boolean isRememberPassword()
{
return rememberPassword;
}
/**
* Sets the rememberPassword value of this jabber account registration.
* @param rememberPassword TRUE if password has to remembered, FALSE
* otherwise
*/
public void setRememberPassword(boolean rememberPassword)
{
this.rememberPassword = rememberPassword;
}
/**
* Returns the User ID of the jabber registration account.
* @return the User ID of the jabber registration account.
*/
public String getUserID()
{
return userID;
}
/**
* Returns the user sufix.
*
* @return the user sufix
*/
public String getDefaultUserSufix()
{
return defaultUserSufix;
}
/**
* Returns the override phone suffix.
*
* @return the phone suffix
*/
public String getOverridePhoneSuffix()
{
return overridePhoneSuffix;
}
/**
* Returns the alwaysCallWithGtalk value.
*
* @return the alwaysCallWithGtalk value
*/
public boolean getBypassGtalkCaps()
{
return bypassGtalkCaps;
}
/**
* Returns telephony domain that bypass GTalk caps.
*
* @return telephony domain
*/
public String getTelephonyDomainBypassCaps()
{
return domainBypassCaps;
}
/**
* The address of the server we will use for this account
* @return String
*/
public String getServerAddress()
{
return serverAddress;
}
/**
* The port on the specified server
* @return the server port
*/
public int getPort()
{
return port;
}
/**
* Determines whether sending of keep alive packets is enabled.
*
* @return <tt>true</tt> if keep alive packets are to be sent for this
* account and <tt>false</tt> otherwise.
*/
public boolean isSendKeepAlive()
{
return sendKeepAlive;
}
/**
* Determines whether SIP Communicator should be querying Gmail servers
* for unread mail messages.
*
* @return <tt>true</tt> if we are to enable Gmail notifications and
* <tt>false</tt> otherwise.
*/
public boolean isGmailNotificationEnabled()
{
return enableGmailNotification;
}
/**
* Determines whether SIP Communicator should use Google Contacts as
* ContactSource
*
* @return <tt>true</tt> if we are to enable Google Contacts and
* <tt>false</tt> otherwise.
*/
public boolean isGoogleContactsEnabled()
{
return enableGoogleContacts;
}
/**
* Sets the User ID of the jabber registration account.
*
* @param userID the identifier of the jabber registration account.
*/
public void setUserID(String userID)
{
this.userID = userID;
}
/**
* Sets the default value of the user sufix.
*
* @param userSufix the user name sufix (the domain name after the @ sign)
*/
public void setDefaultUserSufix(String userSufix)
{
this.defaultUserSufix = userSufix;
}
/**
* Sets the override value of the phone suffix.
*
* @param phoneSuffix the phone name suffix (the domain name after the @
* sign)
*/
public void setOverridePhoneSufix(String phoneSuffix)
{
this.overridePhoneSuffix = phoneSuffix;
}
/**
* Sets value for alwaysCallWithGtalk.
*
* @param bypassGtalkCaps true to enable, false otherwise
*/
public void setBypassGtalkCaps(boolean bypassGtalkCaps)
{
this.bypassGtalkCaps = bypassGtalkCaps;
}
/**
* Sets telephony domain that bypass GTalk caps.
*
* @param text telephony domain to set
*/
public void setTelephonyDomainBypassCaps(String text)
{
this.domainBypassCaps = text;
}
/**
* Sets the server
*
* @param serverAddress the IP address or FQDN of the server.
*/
public void setServerAddress(String serverAddress)
{
this.serverAddress = serverAddress;
}
/**
* Indicates if the server address has been overridden.
*
* @return <tt>true</tt> if the server address has been overridden,
* <tt>false</tt> - otherwise.
*/
public boolean isServerOverridden()
{
return isServerOverridden;
}
/**
* Sets <tt>isServerOverridden</tt> property.
* @param isServerOverridden indicates if the server is overridden
*/
public void setServerOverridden(boolean isServerOverridden)
{
this.isServerOverridden = isServerOverridden;
}
/**
* Sets the server port number.
*
* @param port the server port number
*/
public void setPort(int port)
{
this.port = port;
}
/**
* Specifies whether SIP Communicator should send send keep alive packets
* to keep this account registered.
*
* @param sendKeepAlive <tt>true</tt> if we are to send keep alive packets
* and <tt>false</tt> otherwise.
*/
public void setSendKeepAlive(boolean sendKeepAlive)
{
this.sendKeepAlive = sendKeepAlive;
}
/**
* Specifies whether SIP Communicator should be querying Gmail servers
* for unread mail messages.
*
* @param enabled <tt>true</tt> if we are to enable Gmail notification and
* <tt>false</tt> otherwise.
*/
public void setGmailNotificationEnabled(boolean enabled)
{
this.enableGmailNotification = enabled;
}
/**
* Specifies whether SIP Communicator should use Google Contacts as
* ContactSource.
*
* @param enabled <tt>true</tt> if we are to enable Google Contacts and
* <tt>false</tt> otherwise.
*/
public void setGoogleContactsEnabled(boolean enabled)
{
this.enableGoogleContacts = enabled;
}
/**
* Returns the resource.
* @return the resource
*/
public String getResource()
{
return resource;
}
/**
* Sets the resource.
* @param resource the resource for the jabber account
*/
public void setResource(String resource)
{
this.resource = resource;
}
/**
* Returns the priority property.
* @return priority
*/
public int getPriority()
{
return priority;
}
/**
* Sets the priority property.
* @param priority the priority to set
*/
public void setPriority(int priority)
{
this.priority = priority;
}
/**
* Indicates if ice should be used for this account.
* @return <tt>true</tt> if ICE should be used for this account, otherwise
* returns <tt>false</tt>
*/
public boolean isUseIce()
{
return isUseIce;
}
/**
* Sets the <tt>useIce</tt> property.
* @param isUseIce <tt>true</tt> to indicate that ICE should be used for
* this account, <tt>false</tt> - otherwise.
*/
public void setUseIce(boolean isUseIce)
{
this.isUseIce = isUseIce;
}
/**
* Indicates if ice should be used for this account.
* @return <tt>true</tt> if ICE should be used for this account, otherwise
* returns <tt>false</tt>
*/
public boolean isUseGoogleIce()
{
return isUseGoogleIce;
}
/**
* Sets the <tt>useGoogleIce</tt> property.
* @param isUseIce <tt>true</tt> to indicate that ICE should be used for
* this account, <tt>false</tt> - otherwise.
*/
public void setUseGoogleIce(boolean isUseIce)
{
this.isUseGoogleIce = isUseIce;
}
/**
* Indicates if the stun server should be automatically discovered.
* @return <tt>true</tt> if the stun server should be automatically
* discovered, otherwise returns <tt>false</tt>.
*/
public boolean isAutoDiscoverStun()
{
return isAutoDiscoverStun;
}
/**
* Sets the <tt>autoDiscoverStun</tt> property.
* @param isAutoDiscover <tt>true</tt> to indicate that stun server should
* be auto-discovered, <tt>false</tt> - otherwise.
*/
public void setAutoDiscoverStun(boolean isAutoDiscover)
{
this.isAutoDiscoverStun = isAutoDiscover;
}
/**
* Indicates if the stun server should be automatically discovered.
* @return <tt>true</tt> if the stun server should be automatically
* discovered, otherwise returns <tt>false</tt>.
*/
public boolean isUseDefaultStunServer()
{
return isUseDefaultStunServer;
}
/**
* Sets the <tt>useDefaultStunServer</tt> property.
* @param isUseDefaultStunServer <tt>true</tt> to indicate that default
* stun server should be used if no others are available, <tt>false</tt>
* otherwise.
*/
public void setUseDefaultStunServer(boolean isUseDefaultStunServer)
{
this.isUseDefaultStunServer = isUseDefaultStunServer;
}
/**
* Adds the given <tt>stunServer</tt> to the list of additional stun servers.
*
* @param stunServer the <tt>StunServer</tt> to add
*/
public void addStunServer(StunServerDescriptor stunServer)
{
additionalStunServers.add(stunServer);
}
/**
* Returns the <tt>List</tt> of all additional stun servers entered by the
* user. The list is guaranteed not to be <tt>null</tt>.
*
* @return the <tt>List</tt> of all additional stun servers entered by the
* user.
*/
public List<StunServerDescriptor> getAdditionalStunServers()
{
return additionalStunServers;
}
/**
* Sets the <tt>autoDiscoverJingleNodes</tt> property.
*
* @param isAutoDiscover <tt>true</tt> to indicate that relay server should
* be auto-discovered, <tt>false</tt> - otherwise.
*/
public void setAutoDiscoverJingleNodes(boolean isAutoDiscover)
{
this.isAutoDiscoverJingleNodes = isAutoDiscover;
}
/**
* Indicates if the JingleNodes relay server should be automatically
* discovered.
*
* @return <tt>true</tt> if the relay server should be automatically
* discovered, otherwise returns <tt>false</tt>.
*/
public boolean isAutoDiscoverJingleNodes()
{
return isAutoDiscoverJingleNodes;
}
/**
* Sets the <tt>useJingleNodes</tt> property.
*
* @param isUseJingleNodes <tt>true</tt> to indicate that Jingle Nodes
* should be used for this account, <tt>false</tt> - otherwise.
*/
public void setUseJingleNodes(boolean isUseJingleNodes)
{
this.isUseJingleNodes = isUseJingleNodes;
}
/**
* Sets the <tt>useJingleNodes</tt> property.
*
* @param isUseJingleNodes <tt>true</tt> to indicate that JingleNodes relays
* should be used for this account, <tt>false</tt> - otherwise.
*/
public void isUseJingleNodes(boolean isUseJingleNodes)
{
this.isUseJingleNodes = isUseJingleNodes;
}
/**
* Indicates if JingleNodes relay should be used.
*
* @return <tt>true</tt> if JingleNodes should be used, <tt>false</tt>
* otherwise
*/
public boolean isUseJingleNodes()
{
return isUseJingleNodes;
}
/**
* Adds the given <tt>node</tt> to the list of additional JingleNodes.
*
* @param node the <tt>node</tt> to add
*/
public void addJingleNodes(JingleNodeDescriptor node)
{
additionalJingleNodes.add(node);
}
/**
* Returns the <tt>List</tt> of all additional stun servers entered by the
* user. The list is guaranteed not to be <tt>null</tt>.
*
* @return the <tt>List</tt> of all additional stun servers entered by the
* user.
*/
public List<JingleNodeDescriptor> getAdditionalJingleNodes()
{
return additionalJingleNodes;
}
/**
* Indicates if UPnP should be used for this account.
* @return <tt>true</tt> if UPnP should be used for this account, otherwise
* returns <tt>false</tt>
*/
public boolean isUseUPNP()
{
return isUseUPNP;
}
/**
* Sets the <tt>useUPNP</tt> property.
* @param isUseUPNP <tt>true</tt> to indicate that UPnP should be used for
* this account, <tt>false</tt> - otherwise.
*/
public void setUseUPNP(boolean isUseUPNP)
{
this.isUseUPNP = isUseUPNP;
}
/**
* Is resource auto generate enabled.
*
* @return true if resource is auto generated
*/
public boolean isResourceAutogenerated()
{
return resourceAutogenerated;
}
/**
* Set whether resource autogenerate is enabled.
* @param resourceAutogenerated
*/
public void setResourceAutogenerated(boolean resourceAutogenerated)
{
this.resourceAutogenerated = resourceAutogenerated;
}
}
|