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
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
|
/*
* 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.impl.gui.utils;
import java.util.*;
import net.java.sip.communicator.impl.gui.*;
import net.java.sip.communicator.service.configuration.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.util.*;
public class ConfigurationManager
{
public static final String ENTER_COMMAND = "Enter";
public static final String CTRL_ENTER_COMMAND = "Ctrl-Enter";
/**
* Indicates whether the message automatic popup is enabled.
*/
private static boolean autoPopupNewMessage = false;
private static String sendMessageCommand;
private static boolean isCallPanelShown = true;
private static boolean isShowOffline = true;
private static boolean isApplicationVisible = true;
private static boolean isQuitWarningShown = true;
private static boolean isSendTypingNotifications;
private static boolean isMoveContactConfirmationRequested = true;
private static boolean isMultiChatWindowEnabled;
private static boolean isHistoryLoggingEnabled;
private static boolean isHistoryShown;
private static int chatHistorySize;
private static int windowTransparency;
private static boolean isTransparentWindowEnabled;
private static boolean isWindowDecorated;
private static ConfigurationService configService
= GuiActivator.getConfigurationService();
private static String lastContactParent = null;
/**
*
*/
public static void loadGuiConfigurations()
{
configService.addPropertyChangeListener(
new ConfigurationChangeListener());
// Load the "auPopupNewMessage" property.
String autoPopupProperty =
"service.gui.AUTO_POPUP_NEW_MESSAGE";
String autoPopup = configService.getString(autoPopupProperty);
if(autoPopup == null)
autoPopup = GuiActivator.getResources().
getSettingsString(autoPopupProperty);
if(autoPopup != null && autoPopup.equalsIgnoreCase("yes"))
autoPopupNewMessage = true;
// Load the "sendMessageCommand" property.
String messageCommandProperty =
"service.gui.SEND_MESSAGE_COMMAND";
String messageCommand = configService.getString(messageCommandProperty);
if(messageCommand == null)
messageCommand =
GuiActivator.getResources().getSettingsString(messageCommandProperty);
if(messageCommand == null || messageCommand.length() == 0)
sendMessageCommand = messageCommand;
// Load the showCallPanel property.
String callPanelShown = configService.getString(
"net.java.sip.communicator.impl.gui.showCallPanel");
if(callPanelShown != null && callPanelShown.length() > 0)
{
isCallPanelShown = Boolean.parseBoolean(callPanelShown);
}
// Load the "showOffline" property.
String showOffline = configService.getString(
"net.java.sip.communicator.impl.gui.showOffline");
if(showOffline != null && showOffline.length() > 0)
{
isShowOffline = Boolean.parseBoolean(showOffline);
}
// Load the "showApplication" property.
String isVisible = configService.getString(
"net.java.sip.communicator.impl.systray.showApplication");
if(isVisible != null && isVisible.length() > 0)
{
isApplicationVisible = new Boolean(isVisible).booleanValue();
}
// Load the "showAppQuitWarning" property.
String quitWarningShown = configService.getString(
"net.java.sip.communicator.impl.gui.quitWarningShown");
if(quitWarningShown != null && quitWarningShown.length() > 0)
{
isQuitWarningShown
= Boolean.parseBoolean(quitWarningShown);
}
// Load the "sendTypingNotifications" property.
String isSendTypingNotifProperty =
"service.gui.SEND_TYPING_NOTIFICATIONS_ENABLED";
String isSendTypingNotif =
configService.getString(isSendTypingNotifProperty);
if(isSendTypingNotif == null)
isSendTypingNotif =
GuiActivator.getResources().
getSettingsString(isSendTypingNotifProperty);
if(isSendTypingNotif != null && isSendTypingNotif.length() > 0)
{
isSendTypingNotifications
= Boolean.parseBoolean(isSendTypingNotif);
}
// Load the "isMoveContactConfirmationRequested" property.
String isMoveContactConfirmationRequestedString
= configService.getString(
"net.java.sip.communicator.impl.gui.isMoveContactConfirmationRequested");
if(isMoveContactConfirmationRequestedString != null
&& isMoveContactConfirmationRequestedString.length() > 0)
{
isMoveContactConfirmationRequested
= Boolean.parseBoolean(isMoveContactConfirmationRequestedString)
;
}
// Load the "isMultiChatWindowEnabled" property.
String isMultiChatWindowEnabledStringProperty
= "service.gui.IS_MULTI_CHAT_WINDOW_ENABLED";
String isMultiChatWindowEnabledString
= configService.getString(isMultiChatWindowEnabledStringProperty);
if(isMultiChatWindowEnabledString == null)
isMultiChatWindowEnabledString =
GuiActivator.getResources().
getSettingsString(isMultiChatWindowEnabledStringProperty);
if(isMultiChatWindowEnabledString != null
&& isMultiChatWindowEnabledString.length() > 0)
{
isMultiChatWindowEnabled
= Boolean.parseBoolean(isMultiChatWindowEnabledString)
;
}
// Load the "isHistoryLoggingEnabled" property.
String isHistoryLoggingEnabledString
= configService.getString(
"net.java.sip.communicator.impl.gui.isHistoryLoggingEnabled");
if(isHistoryLoggingEnabledString != null
&& isHistoryLoggingEnabledString.length() > 0)
{
isHistoryLoggingEnabled
= Boolean.parseBoolean(isHistoryLoggingEnabledString)
;
}
// Load the "isHistoryShown" property.
String isHistoryShownStringProperty =
"service.gui.IS_MESSAGE_HISTORY_SHOWN";
String isHistoryShownString
= configService.getString(isHistoryShownStringProperty);
if(isHistoryShownString == null)
isHistoryShownString =
GuiActivator.getResources().
getSettingsString(isHistoryShownStringProperty);
if(isHistoryShownString != null
&& isHistoryShownString.length() > 0)
{
isHistoryShown
= Boolean.parseBoolean(isHistoryShownString)
;
}
// Load the "chatHistorySize" property.
String chatHistorySizeStringProperty =
"service.gui.MESSAGE_HISTORY_SIZE";
String chatHistorySizeString
= configService.getString(chatHistorySizeStringProperty);
if(chatHistorySizeString == null)
chatHistorySizeString =
GuiActivator.getResources().
getSettingsString(chatHistorySizeStringProperty);
if(chatHistorySizeString != null
&& chatHistorySizeString.length() > 0)
{
chatHistorySize
= new Integer(chatHistorySizeString)
.intValue();
}
// Load the "isTransparentWindowEnabled" property.
String isTransparentWindowEnabledProperty =
"impl.gui.IS_TRANSPARENT_WINDOW_ENABLED";
String isTransparentWindowEnabledString
= configService.getString(isTransparentWindowEnabledProperty);
if(isTransparentWindowEnabledString == null)
isTransparentWindowEnabledString =
GuiActivator.getResources().
getSettingsString(isTransparentWindowEnabledProperty);
if(isTransparentWindowEnabledString != null
&& isTransparentWindowEnabledString.length() > 0)
{
isTransparentWindowEnabled
= Boolean.parseBoolean(isTransparentWindowEnabledString);
}
// Load the "windowTransparency" property.
String windowTransparencyProperty =
"impl.gui.WINDOW_TRANSPARENCY";
String windowTransparencyString
= configService.getString(windowTransparencyProperty);
if(windowTransparencyString == null)
windowTransparencyString =
GuiActivator.getResources().
getSettingsString(windowTransparencyProperty);
if(windowTransparencyString != null
&& windowTransparencyString.length() > 0)
{
windowTransparency
= new Integer(windowTransparencyString).intValue();
}
// Load the "isWindowDecorated" property.
String isWindowDecoratedProperty
= "impl.gui.IS_WINDOW_DECORATED";
String isWindowDecoratedString
= configService.getString(isWindowDecoratedProperty);
if(isWindowDecoratedString == null)
isWindowDecoratedString =
GuiActivator.getResources().
getSettingsString(isWindowDecoratedProperty);
if(isWindowDecoratedString != null
&& isWindowDecoratedString.length() > 0)
{
isWindowDecorated
= Boolean.parseBoolean(isWindowDecoratedString);
}
// Load the "lastContactParent" property.
lastContactParent = configService.getString(
"net.java.sip.communicator.impl.gui.addcontact.lastContactParent");
}
/**
* Return TRUE if "autoPopupNewMessage" property is true, otherwise - return
* FALSE. Indicates to the user interface whether new messages should be
* opened and bring to front.
* @return TRUE if "autoPopupNewMessage" property is true, otherwise - return
* FALSE.
*/
public static boolean isAutoPopupNewMessage()
{
return autoPopupNewMessage;
}
/**
* Return TRUE if "showCallPanel" property is true, otherwise - return
* FALSE. Indicates to the user interface whether the panel containing the
* call and hangup buttons should be shown.
* @return TRUE if "showCallPanel" property is true, otherwise - return
* FALSE.
*/
public static boolean isCallPanelShown()
{
return isCallPanelShown;
}
/**
* Return TRUE if "showOffline" property is true, otherwise - return
* FALSE. Indicates to the user interface whether offline user should be
* shown in the contact list or not.
* @return TRUE if "showOffline" property is true, otherwise - return
* FALSE.
*/
public static boolean isShowOffline()
{
return isShowOffline;
}
/**
* Return TRUE if "showApplication" property is true, otherwise - return
* FALSE. Indicates to the user interface whether the main application
* window should shown or hidden on startup.
* @return TRUE if "showApplication" property is true, otherwise - return
* FALSE.
*/
public static boolean isApplicationVisible()
{
return isApplicationVisible;
}
/**
* Return TRUE if "quitWarningShown" property is true, otherwise -
* return FALSE. Indicates to the user interface whether the quit warning
* dialog should be shown when user clicks on the X button.
* @return TRUE if "quitWarningShown" property is true, otherwise -
* return FALSE. Indicates to the user interface whether the quit warning
* dialog should be shown when user clicks on the X button.
*/
public static boolean isQuitWarningShown()
{
return isQuitWarningShown;
}
/**
* Return TRUE if "sendTypingNotifications" property is true, otherwise -
* return FALSE. Indicates to the user interface whether typing
* notifications are enabled or disabled.
* @return TRUE if "sendTypingNotifications" property is true, otherwise -
* return FALSE.
*/
public static boolean isSendTypingNotifications()
{
return isSendTypingNotifications;
}
/**
* Returns TRUE if the "isMoveContactConfirmationRequested" property is true,
* otherwise - returns FALSE. Indicates to the user interface whether the
* confirmation window during the move contact process is enabled or not.
* @return TRUE if the "isMoveContactConfirmationRequested" property is true,
* otherwise - returns FALSE
*/
public static boolean isMoveContactConfirmationRequested()
{
return isMoveContactConfirmationRequested;
}
/**
* Returns <code>true</code> if the "isMultiChatWindowEnabled" property is
* true, otherwise - returns <code>false</code>. Indicates to the user
* interface whether the chat window could contain multiple chats or just
* one chat.
* @return <code>true</code> if the "isMultiChatWindowEnabled" property is
* true, otherwise - returns <code>false</code>.
*/
public static boolean isMultiChatWindowEnabled()
{
return isMultiChatWindowEnabled;
}
/**
* Returns <code>true</code> if the "isHistoryLoggingEnabled" property is
* true, otherwise - returns <code>false</code>. Indicates to the user
* interface whether the history logging is enabled.
* @return <code>true</code> if the "isHistoryLoggingEnabled" property is
* true, otherwise - returns <code>false</code>.
*/
public static boolean isHistoryLoggingEnabled()
{
return isHistoryLoggingEnabled;
}
/**
* Returns <code>true</code> if the "isHistoryShown" property is
* true, otherwise - returns <code>false</code>. Indicates to the user
* whether the history is shown in the chat window.
* @return <code>true</code> if the "isHistoryShown" property is
* true, otherwise - returns <code>false</code>.
*/
public static boolean isHistoryShown()
{
return isHistoryShown;
}
/**
* Returns <code>true</code> if the "isWindowDecorated" property is
* true, otherwise - returns <code>false</code>..
* @return <code>true</code> if the "isWindowDecorated" property is
* true, otherwise - returns <code>false</code>.
*/
public static boolean isWindowDecorated()
{
return isWindowDecorated;
}
/**
* Return the "sendMessageCommand" property that was saved previously
* through the <tt>ConfigurationService</tt>. Indicates to the user
* interface whether the default send message command is Enter or CTRL-Enter.
* @return "Enter" or "CTRL-Enter" message commands.
*/
public static String getSendMessageCommand()
{
return sendMessageCommand;
}
/**
* Return the "lastContactParent" property that was saved previously
* through the <tt>ConfigurationService</tt>. Indicates
* the last selected group on adding new contact
* @return group name of the last selected group when adding contact.
*/
public static String getLastContactParent()
{
return lastContactParent;
}
/**
* Returns the number of messages from chat history that would be shown in
* the chat window.
* @return the number of messages from chat history that would be shown in
* the chat window.
*/
public static int getChatHistorySize()
{
return chatHistorySize;
}
/**
* Returns <code>true</code> if transparent windows are enabled,
* <code>false</code> otherwise.
*
* @return <code>true</code> if transparent windows are enabled,
* <code>false</code> otherwise.
*/
public static boolean isTransparentWindowEnabled()
{
return isTransparentWindowEnabled;
}
/**
* Returns the transparency value for all transparent windows.
*
* @return the transparency value for all transparent windows.
*/
public static int getWindowTransparency()
{
return windowTransparency;
}
/**
* Sets the transparency value for all transparent windows.
*
* @param the transparency value for all transparent windows.
*/
public static void setWindowTransparency(int transparency)
{
windowTransparency = transparency;
}
/**
* Updates the "showOffline" property through the
* <tt>ConfigurationService</tt>.
*
* @param isShowOffline <code>true</code> to indicate that the
* offline users should be shown, <code>false</code> otherwise.
*/
public static void setShowOffline(boolean isShowOffline)
{
ConfigurationManager.isShowOffline = isShowOffline;
configService.setProperty(
"net.java.sip.communicator.impl.gui.showOffline",
Boolean.toString(isShowOffline));
}
/**
* Updates the "showCallPanel" property through the
* <tt>ConfigurationService</tt>.
*
* @param isCallPanelShown <code>true</code> to indicate that the
* call panel should be shown, <code>false</code> otherwise.
*/
public static void setShowCallPanel(boolean isCallPanelShown)
{
ConfigurationManager.isCallPanelShown = isCallPanelShown;
configService.setProperty(
"net.java.sip.communicator.impl.gui.showCallPanel",
Boolean.toString(isCallPanelShown));
}
/**
* Updates the "showApplication" property through the
* <tt>ConfigurationService</tt>.
*
* @param isVisible <code>true</code> to indicate that the
* application should be shown, <code>false</code> otherwise.
*/
public static void setApplicationVisible(boolean isVisible)
{
isApplicationVisible = isVisible;
configService.setProperty(
"net.java.sip.communicator.impl.systray.showApplication",
Boolean.toString(isVisible));
}
/**
* Updates the "showAppQuitWarning" property through the
* <tt>ConfigurationService</tt>.
*
* @param isWarningShown indicates if the message warning the user that the
* application would not be closed if she clicks the X button would be
* shown again.
*/
public static void setQuitWarningShown(boolean isWarningShown)
{
isQuitWarningShown = isWarningShown;
configService.setProperty(
"net.java.sip.communicator.impl.gui.quitWarningShown",
Boolean.toString(isQuitWarningShown));
}
/**
* Updates the "lastContactParent" property through the
* <tt>ConfigurationService</tt>.
*
* @param groupName the group name of the selected group when adding
* last contact
*/
public static void setLastContactParent(String groupName)
{
lastContactParent = groupName;
configService.setProperty(
"net.java.sip.communicator.impl.gui.addcontact.lastContactParent",
groupName);
}
/**
* Updates the "isMoveContactQuestionEnabled" property through the
* <tt>ConfigurationService</tt>.
*
* @param isRequested indicates if a confirmation would be requested
* from user during the move contact process.
*/
public static void setMoveContactConfirmationRequested(boolean isRequested)
{
isMoveContactConfirmationRequested = isRequested;
configService.setProperty(
"net.java.sip.communicator.impl.gui.isMoveContactConfirmationRequested",
Boolean.toString(isMoveContactConfirmationRequested));
}
/**
* Updates the "isTransparentWindowEnabled" property through the
* <tt>ConfigurationService</tt>.
*
* @param isTransparent indicates if the transparency is enabled in the
* application.
*/
public static void setTransparentWindowEnabled(boolean isTransparent)
{
isTransparentWindowEnabled = isTransparent;
configService.setProperty(
"impl.gui.IS_TRANSPARENT_WINDOW_ENABLED",
Boolean.toString(isTransparentWindowEnabled));
}
/**
* Saves a chat room through the <tt>ConfigurationService</tt>.
*
* @param protocolProvider the protocol provider to which the chat room
* belongs
* @param oldChatRoomId the old identifier of the chat room
* @param newChatRoomId the new identifier of the chat room
* @param newChatRoomName the new chat room name
*/
public static void saveChatRoom( ProtocolProviderService protocolProvider,
String oldChatRoomId,
String newChatRoomId,
String newChatRoomName)
{
String prefix = "net.java.sip.communicator.impl.gui.accounts";
List<String> accounts = configService
.getPropertyNamesByPrefix(prefix, true);
for (String accountRootPropName : accounts)
{
String accountUID
= configService.getString(accountRootPropName);
if(accountUID.equals(protocolProvider
.getAccountID().getAccountUniqueID()))
{
List<String> chatRooms = configService
.getPropertyNamesByPrefix(
accountRootPropName + ".chatRooms", true);
boolean isExistingChatRoom = false;
for (String chatRoomPropName : chatRooms)
{
String chatRoomID
= configService.getString(chatRoomPropName);
if(!oldChatRoomId.equals(chatRoomID))
continue;
isExistingChatRoom = true;
configService.setProperty(chatRoomPropName,
newChatRoomId);
configService.setProperty( chatRoomPropName
+ ".chatRoomName",
newChatRoomName);
}
if(!isExistingChatRoom)
{
String chatRoomNodeName
= "chatRoom" + Long.toString(System.currentTimeMillis());
String chatRoomPackage = accountRootPropName
+ ".chatRooms." + chatRoomNodeName;
configService.setProperty(chatRoomPackage,
newChatRoomId);
configService.setProperty( chatRoomPackage
+ ".chatRoomName",
newChatRoomName);
}
}
}
}
/**
* Updates the status of the chat room through the
* <tt>ConfigurationService</tt>.
*
* @param protocolProvider the protocol provider to which the chat room
* belongs
* @param chatRoomId the identifier of the chat room to update
* @param chatRoomStatus the new status of the chat room
*/
public static void updateChatRoomStatus(
ProtocolProviderService protocolProvider,
String chatRoomId,
String chatRoomStatus)
{
String prefix = "net.java.sip.communicator.impl.gui.accounts";
List<String> accounts = configService
.getPropertyNamesByPrefix(prefix, true);
for (String accountRootPropName : accounts)
{
String accountUID
= configService.getString(accountRootPropName);
if(accountUID.equals(protocolProvider
.getAccountID().getAccountUniqueID()))
{
List<String> chatRooms = configService
.getPropertyNamesByPrefix(
accountRootPropName + ".chatRooms", true);
for (String chatRoomPropName : chatRooms)
{
String chatRoomID
= configService.getString(chatRoomPropName);
if(!chatRoomId.equals(chatRoomID))
continue;
configService.setProperty( chatRoomPropName
+ ".lastChatRoomStatus",
chatRoomStatus);
}
}
}
}
/**
* Returns the last chat room status, saved through the
* <tt>ConfigurationService</tt>.
*
* @param protocolProvider the protocol provider, to which the chat room
* belongs
* @param chatRoomId the identifier of the chat room
* @return the last chat room status, saved through the
* <tt>ConfigurationService</tt>.
*/
public static String getChatRoomStatus(
ProtocolProviderService protocolProvider,
String chatRoomId)
{
String prefix = "net.java.sip.communicator.impl.gui.accounts";
List<String> accounts = configService
.getPropertyNamesByPrefix(prefix, true);
for (String accountRootPropName : accounts)
{
String accountUID
= configService.getString(accountRootPropName);
if(accountUID.equals(protocolProvider
.getAccountID().getAccountUniqueID()))
{
List<String> chatRooms = configService
.getPropertyNamesByPrefix(
accountRootPropName + ".chatRooms", true);
for (String chatRoomPropName : chatRooms)
{
String chatRoomID
= configService.getString(chatRoomPropName);
if(!chatRoomId.equals(chatRoomID))
continue;
return configService.getString( chatRoomPropName
+ ".lastChatRoomStatus");
}
}
}
return null;
}
public static void storeContactListGroupStatus( String groupID,
boolean status)
{
String prefix = "net.java.sip.communicator.impl.gui.contactlist.groups";
List<String> groups = configService
.getPropertyNamesByPrefix(prefix, true);
boolean isExistingGroup = false;
for (String groupRootPropName : groups)
{
String storedID
= configService.getString(groupRootPropName);
if(storedID.equals(groupID))
{
configService.setProperty( groupRootPropName
+ ".isClosed",
Boolean.toString(status));
isExistingGroup = true;
break;
}
}
if(!isExistingGroup)
{
String groupNodeName
= "group" + Long.toString(System.currentTimeMillis());
String groupPackage = prefix + "." + groupNodeName;
configService.setProperty( groupPackage,
groupID);
configService.setProperty( groupPackage
+ ".isClosed",
Boolean.toString(status));
}
}
public static boolean getContactListGroupStatus(String groupID)
{
String prefix = "net.java.sip.communicator.impl.gui.contactlist.groups";
List<String> groups = configService
.getPropertyNamesByPrefix(prefix, true);
for (String groupRootPropName : groups)
{
String storedID
= configService.getString(groupRootPropName);
if(storedID.equals(groupID))
{
String status = (String) configService
.getProperty( groupRootPropName + ".isClosed");
return Boolean.parseBoolean(status);
}
}
return false;
}
private static class ConfigurationChangeListener
implements PropertyChangeListener
{
public void propertyChange(PropertyChangeEvent evt)
{
if (evt.getPropertyName().equals(
"net.java.sip.communicator.impl.gui.addcontact.lastContactParent"))
lastContactParent = (String)evt.getNewValue();
else if (evt.getPropertyName().equals(
"service.gui.AUTO_POPUP_NEW_MESSAGE"))
{
String autoPopupString = (String) evt.getNewValue();
autoPopupNewMessage
= Boolean.parseBoolean(autoPopupString);
}
else if (evt.getPropertyName().equals(
"service.gui.SEND_MESSAGE_COMMAND"))
{
sendMessageCommand
= (String) evt.getNewValue();
}
else if (evt.getPropertyName().equals(
"net.java.sip.communicator.impl.gui.showCallPanel"))
{
String showCallPanelString = (String) evt.getNewValue();
isCallPanelShown
= Boolean.parseBoolean(showCallPanelString);
}
else if (evt.getPropertyName().equals(
"net.java.sip.communicator.impl.gui.showOffline"))
{
String showOfflineString = (String) evt.getNewValue();
isShowOffline
= Boolean.parseBoolean(showOfflineString);
}
else if (evt.getPropertyName().equals(
"net.java.sip.communicator.impl.systray.showApplication"))
{
String showApplicationString = (String) evt.getNewValue();
isApplicationVisible
= new Boolean(showApplicationString).booleanValue();
}
else if (evt.getPropertyName().equals(
"net.java.sip.communicator.impl.gui.quitWarningShown"))
{
String showQuitWarningString = (String) evt.getNewValue();
isQuitWarningShown
= Boolean.parseBoolean(showQuitWarningString);
}
else if (evt.getPropertyName().equals(
"service.gui.SEND_TYPING_NOTIFICATIONS_ENABLED"))
{
String sendTypingNorifString = (String) evt.getNewValue();
isSendTypingNotifications
= Boolean.parseBoolean(sendTypingNorifString);
}
else if (evt.getPropertyName().equals(
"net.java.sip.communicator.impl.gui.isMoveContactConfirmationRequested"))
{
String moveContactConfirmString = (String) evt.getNewValue();
isMoveContactConfirmationRequested
= Boolean.parseBoolean(moveContactConfirmString);
}
else if (evt.getPropertyName().equals(
"service.gui.IS_MULTI_CHAT_WINDOW_ENABLED"))
{
String multiChatWindowString = (String) evt.getNewValue();
isMultiChatWindowEnabled
= Boolean.parseBoolean(multiChatWindowString);
}
else if (evt.getPropertyName().equals(
"net.java.sip.communicator.impl.gui.isHistoryLoggingEnabled"))
{
String historyLoggingString = (String) evt.getNewValue();
isHistoryLoggingEnabled
= Boolean.parseBoolean(historyLoggingString);
}
else if (evt.getPropertyName().equals(
"service.gui.IS_MESSAGE_HISTORY_SHOWN"))
{
String historyShownString = (String) evt.getNewValue();
isHistoryShown
= Boolean.parseBoolean(historyShownString);
}
else if (evt.getPropertyName().equals(
"service.gui.MESSAGE_HISTORY_SIZE"))
{
String chatHistorySizeString = (String) evt.getNewValue();
chatHistorySize
= new Integer(chatHistorySizeString).intValue();
}
else if (evt.getPropertyName().equals(
"impl.gui.IS_TRANSPARENT_WINDOW_ENABLED"))
{
String isTransparentString = (String) evt.getNewValue();
isTransparentWindowEnabled
= Boolean.parseBoolean(isTransparentString);
}
else if (evt.getPropertyName().equals(
"impl.gui.WINDOW_TRANSPARENCY"))
{
String windowTransparencyString = (String) evt.getNewValue();
windowTransparency
= new Integer(windowTransparencyString).intValue();
}
}
}
}
|