001    package com.skype.api;
002    
003    import java.io.IOException;
004    import java.util.Collections;
005    import java.util.EnumSet;
006    import java.util.HashMap;
007    import java.util.Iterator;
008    import java.util.Map;
009    import java.util.Vector;
010    
011    import com.skype.api.Account.AccountListener;
012    import com.skype.api.Contact.ContactListener;
013    import com.skype.api.ContactGroup.ContactGroupListener;
014    import com.skype.api.ContactSearch.ContactSearchListener;
015    import com.skype.api.Conversation.ConversationListener;
016    import com.skype.api.Message.MessageListener;
017    import com.skype.api.Participant.DTMF;
018    import com.skype.api.Participant.ParticipantListener;
019    import com.skype.api.Sms.SmsListener;
020    import com.skype.api.Transfer.TransferListener;
021    import com.skype.api.Video.VideoListener;
022    import com.skype.api.Voicemail.VoicemailListener;
023    import com.skype.ipc.AbstractDecoder;
024    import com.skype.ipc.Event;
025    import com.skype.ipc.PropertyChange;
026    import com.skype.ipc.Request;
027    import com.skype.ipc.Response;
028    import com.skype.ipc.RootObject;
029    import com.skype.ipc.XCallRequest;
030    
031    public class Skype extends RootObject {
032    
033            
034            public interface SkypeListener {
035                    public void OnNewCustomContactGroup(ContactGroup group);
036                    
037                    /**This contact has appeared online. display alert*/
038                    public void OnContactOnlineAppearance(Contact contact);
039                    
040                    /**This contact has gone offline. display alert*/
041                    public void OnContactGoneOffline(Contact contact);
042                    
043                    /**This event gets fired when a Conversation item is added or removed from the list specified in the type argument. The primary use of this event is to detect creation of new Conversation objects. It can also be used for detecting occurance of live sessions - by monitoring added = true in Conversation.LIVE_CONVERSATIONS. Note that this method is not entirely sufficient for detecting live session termination (added = false and type = Conversation.LIVE_CONVERSATIONS). When the live session goes down, the default behaviour is that the Conversation object remains in the LIVE_CONVERSATIONS list for approximately 10 seconds. When another live session comes up within the same Conversation, the OnConversationListChange event will not fire - because the conversation was already in that list. There are two ways of getting around that. Firstly you can have all the conversations referenced at all times and then monitor Conversation.P_LOCAL_LIVESTATUS property changes, in which case you can pick up incoming live sessions from there. Alternatively, you can remove the delay between live session termination and conversation's removal from the LIVE_CONVERSATIONS list. This delay is controlled by the SETUPKEY_RECENTLY_LIVE_TIMEOUT setup key. To remove the delay, use Skype.SetInt(SETUPKEY_RECENTLY_LIVE_TIMEOUT, 0). Note that this setup key is account-based. You will need to have an account logged in in order to modify its value. <br>*/
044                    public void OnConversationListChange(Conversation conversation, Conversation.LIST_TYPE type, boolean added);
045                    
046                    public void OnMessage(Message message, boolean changesInboxTimestamp, Message supersedesHistoryMessage, Conversation conversation);
047                    
048                    /**This callback gets fired when there are changes in the system video device list (USB webcam gets plugged in or is detached.) <br>*/
049                    public void OnAvailableVideoDeviceListChange();
050                    
051                    /**Event is implemented only in SkypeKit builds. Fired when Skype video library uses software H264 codec for the first time on the particular hardware by particular SkypeKit-based application*/
052                    public void OnH264Activated();
053                    
054                    public void OnQualityTestResult(QUALITYTESTTYPE testType, QUALITYTESTRESULT testResult, String withUser, String details, String xmlDetails);
055                    
056                    /**This callback gets fired when there are changes in the system audio device list (USB headset gets plugged in or is detached.) <br>*/
057                    public void OnAvailableDeviceListChange();
058                    
059                    /**This callback gets fired when the audio strength changes in either playback or recording audio streams. Useful for providing visual indicators of audio activity in your UI. <br>*/
060                    public void OnNrgLevelsChange();
061                    
062                    public void OnProxyAuthFailure(PROXYTYPE type);
063                    
064            }
065            
066            public HashMap<Integer, SkypeObject> object_list_base;
067            public HashMap<Integer, Object> listeners_base;
068            public Map<Integer, SkypeObject> object_list;
069            public Map<Integer, Object> listeners;
070            
071            private Skype skype;
072            
073            public Skype() {
074                    object_list_base = new HashMap<Integer, SkypeObject>();
075                    listeners_base = new HashMap<Integer, Object>();
076                    
077                    object_list = Collections.synchronizedMap(object_list_base);
078                    listeners = Collections.synchronizedMap(listeners_base);
079                    skype = this;
080            }
081            
082            private static final int module_id = 0;
083            
084            public static final int getmoduleid() {
085                    return module_id;
086            }
087            
088            /** Register listener interface, need to pass module id as first param*/
089            public void RegisterListener(int modid, Object listener)
090            {
091                    listeners.put(modid, listener);
092            }
093            
094            /** Remove listener interface, need to pass module id as first param*/
095            public void UnRegisterListener(int modid, Object listener)
096            {
097                    if (listeners.containsKey(modid))
098                            listeners.remove(modid);
099            }
100            
101            public void HandlePropertyChange(PropertyChange pc){
102                    SkypeObject obj = null;
103                    Object val = null;
104                    Object prop = null;
105                    
106                    //check object exists in list and get value 
107                    if (object_list.containsKey(pc.oid))
108                    {
109                            obj = object_list.get(pc.oid);
110                            int kind = pc.GetKind();
111                            
112                            switch (kind) {
113                                    case 'i':
114                                    case 'u':
115                                    case 'e':
116                                            try {
117                                                    val = new Integer(pc.GetAsInt());
118                                            } catch (IOException e) {
119                                                    e.printStackTrace();
120                                                    if (errorListener!=null)
121                                                            errorListener.OnSkypeKitFatalError();
122                                            }
123                                            break;
124                                    case 'T':
125                                    case 'F':
126                                            try {
127                                                    val = new Boolean(pc.GetAsBoolean());
128                                            } catch (IOException e) {
129                                                    e.printStackTrace();
130                                                    if (errorListener!=null)
131                                                            errorListener.OnSkypeKitFatalError();
132                                            }
133                                            break;
134                                    case 'S':
135                                    case 'X':
136                                    case 'f':
137                                            try {
138                                                    val = new String(pc.GetAsString());
139                                            } catch (IOException e) {
140                                                    e.printStackTrace();
141                                                    if (errorListener!=null)
142                                                            errorListener.OnSkypeKitFatalError();
143                                            }
144                                            break;
145                                    case 'B':
146                                            if (pc.hasValue()){
147                                                    try {
148                                                            val = new String(pc.GetAsBinary(0));
149                                                    } catch (IOException e) {
150                                                            e.printStackTrace();
151                                                            if (errorListener!=null)
152                                                                    errorListener.OnSkypeKitFatalError();
153                                                    }
154                                            }
155                                            break;
156                                    default:
157                                            break;
158                            }
159                            
160                            //update the property cache
161                            if (val!=null) {
162                                    obj.mPropCache.put(pc.propid, val);
163                            }
164                            else {
165                                    obj.mPropCache.remove(pc.propid);
166                            }
167                            //call listener if this exists?
168                            if (listeners.containsKey(pc.moid))
169                             {
170                                    Object listener = listeners.get(pc.moid);
171                                    if (listener != null){
172                                            prop = obj.GetPropertyAsEnum(pc.propid);
173                                            
174                                            switch (pc.moid)
175                                            {
176                                            case 5: //Account
177                                                    ((AccountListener) listener).OnPropertyChange(obj, (Account.PROPERTY)prop, val);
178                                                    break;
179                                                    
180                                            case 2: //Contact
181                                                    ((ContactListener) listener).OnPropertyChange(obj, (Contact.PROPERTY)prop, val);
182                                                    break;
183                                                    
184                                            case 10: //ContactGroup
185                                                    ((ContactGroupListener) listener).OnPropertyChange(obj, (ContactGroup.PROPERTY)prop, val);
186                                                    break;
187                                                    
188                                            case 1: //ContactSearch
189                                                    ((ContactSearchListener) listener).OnPropertyChange(obj, (ContactSearch.PROPERTY)prop, val);
190                                                    break;
191                                                    
192                                            case 18: //Conversation
193                                                    ((ConversationListener) listener).OnPropertyChange(obj, (Conversation.PROPERTY)prop, val);
194                                                    break;
195                                                    
196                                            case 9: //Message
197                                                    ((MessageListener) listener).OnPropertyChange(obj, (Message.PROPERTY)prop, val);
198                                                    break;
199                                                    
200                                            case 19: //Participant
201                                                    ((ParticipantListener) listener).OnPropertyChange(obj, (Participant.PROPERTY)prop, val);
202                                                    break;
203                                                    
204                                            case 12: //Sms
205                                                    ((SmsListener) listener).OnPropertyChange(obj, (Sms.PROPERTY)prop, val);
206                                                    break;
207                                                    
208                                            case 6: //Transfer
209                                                    ((TransferListener) listener).OnPropertyChange(obj, (Transfer.PROPERTY)prop, val);
210                                                    break;
211                                                    
212                                            case 11: //Video
213                                                    ((VideoListener) listener).OnPropertyChange(obj, (Video.PROPERTY)prop, val);
214                                                    break;
215                                                    
216                                            case 7: //Voicemail
217                                                    ((VoicemailListener) listener).OnPropertyChange(obj, (Voicemail.PROPERTY)prop, val);
218                                                    break;
219                                                    
220                                            default:
221                                                    break;
222                                            }
223                                    }
224                            }
225                    }
226            }
227            
228            @Override
229            public void Close() throws IOException {
230                    FlushObjects();
231                    super.Close();
232            }
233            
234            /**Clear all Skypekit Objects and PROPERTIES in object cache */
235            public void FlushObjects()
236            {
237                    Iterator<Integer> iter = object_list.keySet().iterator();
238                    while (iter.hasNext()) {
239                            Integer key = iter.next();
240                            SkypeObject obj  = object_list.get(key);
241                            obj.flush_cache();
242                    }
243                    object_list.clear();
244            }
245            
246            /** Mobile Mode related keys for Skypekit runtime*/
247            private static final String mobileModeEnabled        = "*Lib/PM/MobileModeEnabled";
248            private static final String superNodeKeepalivePeriod = "*Lib/Connection/SupernodeKeepalivePeriod";
249            private static final String statsUpdatePeriod        = "*Lib/Connection/StatsUpdatePeriod";
250            
251            private static final String IgnoreReadChatMsg     = "*Lib/Chat/IgnoreReadChatMsg";
252            
253            /** Turn on Mobile Optimisations in Skypekit runtime and configure Skypekit not to send already read messages*/
254            public void SetMobileMode () {
255                    SetInt(mobileModeEnabled, 1);
256                    SetInt(superNodeKeepalivePeriod, 600);
257                    SetInt(statsUpdatePeriod, 600);
258                    SetInt(IgnoreReadChatMsg, 1);}
259            
260            /**Static method to retrieve Voicemail object from object id*/
261            public Voicemail GetVoiceMailFromId(int oid, Skype skype)
262            {
263                    Voicemail vm = null;
264                    if (skype.object_list.containsKey(oid))
265                    {
266                            vm = (Voicemail) skype.object_list.get(oid);
267                    }
268                    else
269                    {
270                            vm = new Voicemail(oid,skype);
271                    }
272                    return vm;
273            }
274            
275            
276            @Override
277            public void HandleEvent(Event e) {
278            
279                    HandleEvent_inner(e);
280            
281            }
282            public void HandleEvent_inner(Event e) {
283                    if (listeners.containsKey(e.getModuleId())) {
284                    
285                            switch (e.getModuleId()) {
286                            case 0: // Skype Listener Events
287                                    SkypeListener skypelistener = (SkypeListener) listeners.get(e.getModuleId());
288                                    if (skypelistener != null) {
289                                    
290                                            switch (e.getEventId()) {
291                                            case 1:  // OnNewCustomContactGroup
292                                                    int  group01_oid = 0;
293                                                    ContactGroup group01 = null;
294                                                    group01_oid = e.GetOid(1);
295                                                    if (group01_oid != AbstractDecoder.NULL_VALUE) {
296                                                            group01 = (ContactGroup)skype.factory(ContactGroup.moduleID(), group01_oid, skype);
297                                                    }
298                                                    skypelistener.OnNewCustomContactGroup(group01);
299                                                    break;
300                                                    
301                                            case 2:  // OnContactOnlineAppearance
302                                                    int  contact02_oid = 0;
303                                                    Contact contact02 = null;
304                                                    contact02_oid = e.GetOid(1);
305                                                    if (contact02_oid != AbstractDecoder.NULL_VALUE) {
306                                                            contact02 = (Contact)skype.factory(Contact.moduleID(), contact02_oid, skype);
307                                                    }
308                                                    skypelistener.OnContactOnlineAppearance(contact02);
309                                                    break;
310                                                    
311                                            case 3:  // OnContactGoneOffline
312                                                    int  contact03_oid = 0;
313                                                    Contact contact03 = null;
314                                                    contact03_oid = e.GetOid(1);
315                                                    if (contact03_oid != AbstractDecoder.NULL_VALUE) {
316                                                            contact03 = (Contact)skype.factory(Contact.moduleID(), contact03_oid, skype);
317                                                    }
318                                                    skypelistener.OnContactGoneOffline(contact03);
319                                                    break;
320                                                    
321                                            case 4:  // OnConversationListChange
322                                                    int  conversation04_oid = 0;
323                                                    Conversation conversation04 = null;
324                                                    conversation04_oid = e.GetOid(1);
325                                                    if (conversation04_oid != AbstractDecoder.NULL_VALUE) {
326                                                            conversation04 = (Conversation)skype.factory(Conversation.moduleID(), conversation04_oid, skype);
327                                                    }
328                                                    Conversation.LIST_TYPE type04 = null;
329                                                    type04 = Conversation.LIST_TYPE.get(e.GetAsInt(2));
330                                                    boolean added04 = false;
331                                                    added04 = e.GetAsBoolean(3);
332                                                    skypelistener.OnConversationListChange(conversation04, type04, added04);
333                                                    break;
334                                                    
335                                            case 5:  // OnMessage
336                                                    int  message05_oid = 0;
337                                                    Message message05 = null;
338                                                    message05_oid = e.GetOid(1);
339                                                    if (message05_oid != AbstractDecoder.NULL_VALUE) {
340                                                            message05 = (Message)skype.factory(Message.moduleID(), message05_oid, skype);
341                                                    }
342                                                    boolean changesInboxTimestamp05 = false;
343                                                    changesInboxTimestamp05 = e.GetAsBoolean(2);
344                                                    int  supersedesHistoryMessage05_oid = 0;
345                                                    Message supersedesHistoryMessage05 = null;
346                                                    supersedesHistoryMessage05_oid = e.GetOid(3);
347                                                    if (supersedesHistoryMessage05_oid != AbstractDecoder.NULL_VALUE) {
348                                                            supersedesHistoryMessage05 = (Message)skype.factory(Message.moduleID(), supersedesHistoryMessage05_oid, skype);
349                                                    }
350                                                    int  conversation05_oid = 0;
351                                                    Conversation conversation05 = null;
352                                                    conversation05_oid = e.GetOid(4);
353                                                    if (conversation05_oid != AbstractDecoder.NULL_VALUE) {
354                                                            conversation05 = (Conversation)skype.factory(Conversation.moduleID(), conversation05_oid, skype);
355                                                    }
356                                                    skypelistener.OnMessage(message05, changesInboxTimestamp05, supersedesHistoryMessage05, conversation05);
357                                                    ConversationListener cl = (ConversationListener)listeners.get(18);
358                                                    if (cl != null) {
359                                                            cl.OnMessage(conversation05, message05);
360                                                    };
361                                                    break;
362                                                    
363                                            case 7:  // OnAvailableVideoDeviceListChange
364                                                    skypelistener.OnAvailableVideoDeviceListChange();
365                                                    break;
366                                                    
367                                            case 44:  // OnH264Activated
368                                                    skypelistener.OnH264Activated();
369                                                    break;
370                                                    
371                                            case 28:  // OnQualityTestResult
372                                                    QUALITYTESTTYPE testType028 = null;
373                                                    testType028 = QUALITYTESTTYPE.get(e.GetAsInt(0));
374                                                    QUALITYTESTRESULT testResult028 = null;
375                                                    testResult028 = QUALITYTESTRESULT.get(e.GetAsInt(1));
376                                                    String withUser028 = null;
377                                                    withUser028 = e.GetAsString(2);
378                                                    String details028 = null;
379                                                    details028 = e.GetAsString(3);
380                                                    String xmlDetails028 = null;
381                                                    skypelistener.OnQualityTestResult(testType028, testResult028, withUser028, details028, xmlDetails028);
382                                                    break;
383                                                    
384                                            case 10:  // OnAvailableDeviceListChange
385                                                    skypelistener.OnAvailableDeviceListChange();
386                                                    break;
387                                                    
388                                            case 11:  // OnNrgLevelsChange
389                                                    skypelistener.OnNrgLevelsChange();
390                                                    break;
391                                                    
392                                            case 12:  // OnProxyAuthFailure
393                                                    PROXYTYPE type012 = null;
394                                                    type012 = PROXYTYPE.get(e.GetAsInt(1));
395                                                    skypelistener.OnProxyAuthFailure(type012);
396                                                    break;
397                                                    
398                                            default:
399                                                    break;
400                                                    
401                                            }
402                                    }
403                                    break;
404                                    
405                                    case 10: // Module ContactGroup
406                                            ContactGroupListener contactgrouplistener = (ContactGroupListener)listeners.get(e.getModuleId());
407                                            if (contactgrouplistener != null) {
408                                                    int contactgroup_oid = e.GetOid(0);
409                                                    SkypeObject obj = skype.factory(e.getModuleId(), contactgroup_oid, skype);
410                                                    
411                                                    switch (e.getEventId()){ 
412                                                    case 1: // Event OnChangeConversation
413                                                            int conversation101_oid = 0;
414                                                            Conversation conversation101 = null;
415                                                            conversation101_oid = e.GetOid(1);
416                                                            if (conversation101_oid != AbstractDecoder.NULL_VALUE) { 
417                                                                    conversation101 = (Conversation)skype.factory(Conversation.moduleID(), conversation101_oid, skype);
418                                                            }
419                                                            contactgrouplistener.OnChangeConversation(obj, conversation101);
420                                                            break;
421                                                            
422                                                    case 2: // Event OnChange
423                                                            int contact102_oid = 0;
424                                                            Contact contact102 = null;
425                                                            contact102_oid = e.GetOid(1);
426                                                            if (contact102_oid != AbstractDecoder.NULL_VALUE) { 
427                                                                    contact102 = (Contact)skype.factory(Contact.moduleID(), contact102_oid, skype);
428                                                            }
429                                                            contactgrouplistener.OnChange(obj, contact102);
430                                                            break;
431                                                            
432                                                    default:
433                                                            break;
434                                                            
435                                                    }
436                                            }
437                                            break;
438                                            
439                                    case 1: // Module ContactSearch
440                                            ContactSearchListener contactsearchlistener = (ContactSearchListener)listeners.get(e.getModuleId());
441                                            if (contactsearchlistener != null) {
442                                                    int contactsearch_oid = e.GetOid(0);
443                                                    SkypeObject obj = skype.factory(e.getModuleId(), contactsearch_oid, skype);
444                                                    
445                                                    switch (e.getEventId()){ 
446                                                    case 1: // Event OnNewResult
447                                                            int contact11_oid = 0;
448                                                            Contact contact11 = null;
449                                                            contact11_oid = e.GetOid(1);
450                                                            if (contact11_oid != AbstractDecoder.NULL_VALUE) { 
451                                                                    contact11 = (Contact)skype.factory(Contact.moduleID(), contact11_oid, skype);
452                                                            }
453                                                            int rankValue11 = 0;
454                                                            rankValue11 = e.GetAsInt(2);
455                                                            contactsearchlistener.OnNewResult(obj, contact11, rankValue11);
456                                                            break;
457                                                            
458                                                    default:
459                                                            break;
460                                                            
461                                                    }
462                                            }
463                                            break;
464                                            
465                                    case 19: // Module Participant
466                                            ParticipantListener participantlistener = (ParticipantListener)listeners.get(e.getModuleId());
467                                            if (participantlistener != null) {
468                                                    int participant_oid = e.GetOid(0);
469                                                    SkypeObject obj = skype.factory(e.getModuleId(), participant_oid, skype);
470                                                    
471                                                    switch (e.getEventId()){ 
472                                                    case 1: // Event OnIncomingDTMF
473                                                            DTMF dtmf191 = null;
474                                                            dtmf191 = DTMF.get(e.GetAsInt(1));
475                                                            participantlistener.OnIncomingDTMF(obj, dtmf191);
476                                                            break;
477                                                            
478                                                    default:
479                                                            break;
480                                                            
481                                                    }
482                                            }
483                                            break;
484                                            
485                                    case 18: // Module Conversation
486                                            ConversationListener conversationlistener = (ConversationListener)listeners.get(e.getModuleId());
487                                            if (conversationlistener != null) {
488                                                    int conversation_oid = e.GetOid(0);
489                                                    SkypeObject obj = skype.factory(e.getModuleId(), conversation_oid, skype);
490                                                    
491                                                    switch (e.getEventId()){ 
492                                                    case 1: // Event OnParticipantListChange
493                                                            conversationlistener.OnParticipantListChange(obj);
494                                                            break;
495                                                            
496                                                    case 2: // Event OnMessage
497                                                            int message182_oid = 0;
498                                                            Message message182 = null;
499                                                            message182_oid = e.GetOid(1);
500                                                            if (message182_oid != AbstractDecoder.NULL_VALUE) { 
501                                                                    message182 = (Message)skype.factory(Message.moduleID(), message182_oid, skype);
502                                                            }
503                                                            conversationlistener.OnMessage(obj, message182);
504                                                            break;
505                                                            
506                                                    case 3: // Event OnSpawnConference
507                                                            int spawned183_oid = 0;
508                                                            Conversation spawned183 = null;
509                                                            spawned183_oid = e.GetOid(1);
510                                                            if (spawned183_oid != AbstractDecoder.NULL_VALUE) { 
511                                                                    spawned183 = (Conversation)skype.factory(Conversation.moduleID(), spawned183_oid, skype);
512                                                            }
513                                                            conversationlistener.OnSpawnConference(obj, spawned183);
514                                                            break;
515                                                            
516                                                    default:
517                                                            break;
518                                                            
519                                                    }
520                                            }
521                                            break;
522                                            
523                                    case 11: // Module Video
524                                            VideoListener videolistener = (VideoListener)listeners.get(e.getModuleId());
525                                            if (videolistener != null) {
526                                                    int video_oid = e.GetOid(0);
527                                                    SkypeObject obj = skype.factory(e.getModuleId(), video_oid, skype);
528                                                    
529                                                    switch (e.getEventId()){ 
530                                                    case 2: // Event OnCaptureRequestCompleted
531                                                            int requestId112 = 0;
532                                                            requestId112 = e.GetAsInt(1);
533                                                            boolean isSuccessful112 = false;
534                                                            isSuccessful112 = e.GetAsBoolean(2);
535                                                            byte[] image112 = null;
536                                                            image112 = e.GetAsBinary(3);
537                                                            int width112 = 0;
538                                                            width112 = e.GetAsInt(4);
539                                                            int height112 = 0;
540                                                            height112 = e.GetAsInt(5);
541                                                            videolistener.OnCaptureRequestCompleted(obj, requestId112, isSuccessful112, image112, width112, height112);
542                                                            break;
543                                                            
544                                                    default:
545                                                            break;
546                                                            
547                                                    }
548                                            }
549                                            break;
550                                            
551                                    default:
552                                            break;
553                                            
554                            }
555                    }
556            }
557            
558            /**
559             * @return started
560             */
561            public boolean Start() {
562            
563                    Request request = null;
564                    try {
565                            request = new XCallRequest(0,145);
566                    } catch (IOException e) {
567                            e.printStackTrace();
568                            if (errorListener != null)
569                                    errorListener.OnSkypeKitFatalError();
570                    }
571                    
572                    Response r = XCall((XCallRequest)request);
573                    
574                    if (r.isErrCall())
575                            return false;
576                            
577                    boolean started = false;
578                    started = r.GetAsBoolean(1);
579                    return started;
580            }
581            
582            /** Setupkey SETUPKEY_DB_STORAGE_QUOTA_KB type:int default value:"0" <br>Use this key to limit the size of the main.db file. Value is in KB. Quota are disabled by default. <br><br><b>NB!</b> This setup key only limits the size of the main database files. It <b>does not include size of sqlite temporary files</b>, such as rollback journals. Sometimes even if this quota is set, the total size of db files on storage can grow more than than the set limit, for short period of time. <br><br>Because of this, as a rule of thumb, you should set this setup key to approximately <b>half</b> of actual available storage space. <br><br>If the storage limit is exceeded (or the database file just runs out of available storage), the currently logged in account will be forcibily logged out, with P_LOGOUT_REASON set to DB_IO_ERROR. <br><br>This setup key is machine-specific and affects all local accounts. <br> */
583            public static final String DB_STORAGE_QUOTA_KB = "*Lib/DbManager/StorageQuotaKb";
584            
585            /**
586             *returns the runtime version as a string
587             * @return version
588             */
589            public String GetVersionString() {
590            
591                    Request request = null;
592                    try {
593                            request = new XCallRequest(0,28);
594                    } catch (IOException e) {
595                            e.printStackTrace();
596                            if (errorListener != null)
597                                    errorListener.OnSkypeKitFatalError();
598                    }
599                    
600                    Response r = XCall((XCallRequest)request);
601                    
602                    if (r.isErrCall())
603                            return null;
604                            
605                    String version = null;
606                    version = r.GetAsString(1);
607                    return version;
608            }
609            
610            /**
611             *Returns the time as used in SkypeKit, in the form of a Unix timestamp (number of seconds since 1.1.1970).                   If the local system time is incorrect my more than one year, the time provided                   by the Skype network will be provided, which is correct. Therefore this function                   can be used to adjust the system time if set incorrectly (e.g. if set to 1.1.1970).
612             * @return timestamp
613             */
614            public int GetUnixTimestamp() {
615            
616                    Request request = null;
617                    try {
618                            request = new XCallRequest(0,134);
619                    } catch (IOException e) {
620                            e.printStackTrace();
621                            if (errorListener != null)
622                                    errorListener.OnSkypeKitFatalError();
623                    }
624                    
625                    Response r = XCall((XCallRequest)request);
626                    
627                    if (r.isErrCall())
628                            return 0;
629                            
630                    int timestamp = 0;
631                    timestamp = r.GetAsInt(1);
632                    return timestamp;
633            }
634            
635            /**
636             *Takes TYPE argument (TYPE comes from ContactGroup class) and returns reference to the corresponding hardwired contact group. For example (C++): skype->GetHardwiredContactGroup(ContactGroup.ONLINE_BUDDIES, GroupRef) would return the list of all contacts that are currently online. <br>
637             * @param type
638             * @return contactGroup
639             */
640            public ContactGroup GetHardwiredContactGroup( ContactGroup.TYPE type) {
641            
642                    Request request = null;
643                    try {
644                            request = new XCallRequest(0,1);
645                    } catch (IOException e) {
646                            e.printStackTrace();
647                            if (errorListener != null)
648                                    errorListener.OnSkypeKitFatalError();
649                    }
650                    request.addParm('e',1,type.getId());
651                    
652                    Response r = XCall((XCallRequest)request);
653                    
654                    if (r.isErrCall())
655                            return null;
656                            
657                    int oid = 0;
658                    ContactGroup contactGroup = null;
659                    oid = r.GetOid(1);
660                    if (oid != AbstractDecoder.NULL_VALUE) {
661                            contactGroup = (ContactGroup)skype.factory(ContactGroup.moduleID(), oid, skype);
662                    }
663                    return contactGroup;
664            }
665            
666            /**
667             *Returns a list of custom contact group references, i.e. all contact groups that are not hardwired. <br>
668             * @return groups
669             */
670            public ContactGroup [] GetCustomContactGroups() {
671            
672                    Request request = null;
673                    try {
674                            request = new XCallRequest(0,2);
675                    } catch (IOException e) {
676                            e.printStackTrace();
677                            if (errorListener != null)
678                                    errorListener.OnSkypeKitFatalError();
679                    }
680                    
681                    Response r = XCall((XCallRequest)request);
682                    
683                    if (r.isErrCall())
684                            return null;
685                            
686                    Vector<ContactGroup> groups = new Vector<ContactGroup>();
687                    while (r.HasMore(1))
688                    {
689                            int oid = 0;
690                            ContactGroup contactgroup = null;
691                            oid = r.GetOid(1);
692                            if (oid != AbstractDecoder.NULL_VALUE) { 
693                                    contactgroup = (ContactGroup)skype.factory(ContactGroup.moduleID(), oid, skype);
694                            }
695                            groups.add(contactgroup);
696                    }
697                    return groups.toArray(new ContactGroup[groups.size()]);
698                    
699            }
700            
701            /**
702             *Creates a new empty contact group object and returns a reference to it. The group will then show up in the custom group list that you can get with Skype class GetCustomContactGroups method. Existing contacts can be added to the new group with ContactGroup class AddContact method and a custom name can be given to it with GiveDisplayName method. <br>Note that no check is made for existing of displaynames with the same name - if you wish to force uniqueness in custom group names you will have to check that yourself before creating the group. <br>
703             * @return group
704             */
705            public ContactGroup CreateCustomContactGroup() {
706            
707                    Request request = null;
708                    try {
709                            request = new XCallRequest(0,3);
710                    } catch (IOException e) {
711                            e.printStackTrace();
712                            if (errorListener != null)
713                                    errorListener.OnSkypeKitFatalError();
714                    }
715                    
716                    Response r = XCall((XCallRequest)request);
717                    
718                    if (r.isErrCall())
719                            return null;
720                            
721                    int oid = 0;
722                    ContactGroup group = null;
723                    oid = r.GetOid(1);
724                    if (oid != AbstractDecoder.NULL_VALUE) {
725                            group = (ContactGroup)skype.factory(ContactGroup.moduleID(), oid, skype);
726                    }
727                    return group;
728            }
729            
730            /**
731             *analyzes the identity for contact type
732             * @param identity
733             * @return type
734             */
735            public Contact.TYPE GetContactType( String identity) {
736            
737                    Request request = null;
738                    try {
739                            request = new XCallRequest(0,5);
740                    } catch (IOException e) {
741                            e.printStackTrace();
742                            if (errorListener != null)
743                                    errorListener.OnSkypeKitFatalError();
744                    }
745                    request.addParm('S',1,identity);
746                    
747                    Response r = XCall((XCallRequest)request);
748                    
749                    if (r.isErrCall())
750                            return null;
751                            
752                    Contact.TYPE type = null;
753                    type = Contact.TYPE.get(r.GetAsInt(1));
754                    return type;
755            }
756            
757            /**
758             *Returns a Contact object reference. If a matching contact is not found in the existing contact list, a new Contact object will be created. Note that if you pass in a phone number in the identity argument, the type for the newly created Contact will be automatically set to Contact.PSTN (Contact.SKYPE otherwise). <br>
759             * @param identity Either skypename or a phone number <br>
760             * @return contact Returns a contact object. <br>
761             */
762            public Contact GetContact( String identity) {
763            
764                    Request request = null;
765                    try {
766                            request = new XCallRequest(0,6);
767                    } catch (IOException e) {
768                            e.printStackTrace();
769                            if (errorListener != null)
770                                    errorListener.OnSkypeKitFatalError();
771                    }
772                    request.addParm('S',1,identity);
773                    
774                    Response r = XCall((XCallRequest)request);
775                    
776                    if (r.isErrCall())
777                            return null;
778                            
779                    int oid = 0;
780                    Contact contact = null;
781                    oid = r.GetOid(2);
782                    if (oid != AbstractDecoder.NULL_VALUE) {
783                            contact = (Contact)skype.factory(Contact.moduleID(), oid, skype);
784                    }
785                    return contact;
786            }
787            
788            /**
789             * @param number
790             * @return FindContactByPstnNumberResult
791             */
792            public FindContactByPstnNumberResult FindContactByPstnNumber( String number) {
793            
794                    Request request = null;
795                    try {
796                            request = new XCallRequest(0,8);
797                    } catch (IOException e) {
798                            e.printStackTrace();
799                            if (errorListener != null)
800                                    errorListener.OnSkypeKitFatalError();
801                    }
802                    request.addParm('S',1,number);
803                    
804                    Response r = XCall((XCallRequest)request);
805                    
806                    if (r.isErrCall())
807                            return null;
808                            
809                    FindContactByPstnNumberResult result = new FindContactByPstnNumberResult();
810                    
811                    boolean found = false;
812                    found = r.GetAsBoolean(1);
813                    result.found = found;
814                    
815                    int oid = 0;
816                    Contact contact = null;
817                    oid = r.GetOid(2);
818                    if (oid != AbstractDecoder.NULL_VALUE) {
819                            contact = (Contact)skype.factory(Contact.moduleID(), oid, skype);
820                    }
821                    result.contact = contact;
822                    
823                    int foundInKey = 0;
824                    foundInKey = r.GetAsInt(3);
825                    result.foundInKey = foundInKey;
826                    
827                    return result;
828            }
829            
830            public class FindContactByPstnNumberResult {
831                    public boolean found;
832                    public Contact contact;
833                    public int foundInKey; /** type is actually PROPKEY */
834            }
835            
836            /**
837             */
838            public enum IDENTITYTYPE {
839            
840                    /** */
841                    UNRECOGNIZED(0),
842                    
843                    /** */
844                    SKYPE(1),
845                    
846                    /** */
847                    SKYPE_MYSELF(2),
848                    
849                    /** */
850                    SKYPE_UNDISCLOSED(3),
851                    
852                    /** */
853                    PSTN(4),
854                    
855                    /** */
856                    PSTN_EMERGENCY(5),
857                    
858                    /** */
859                    PSTN_FREE(6),
860                    
861                    /** */
862                    PSTN_UNDISCLOSED(7),
863                    
864                    /** */
865                    CONFERENCE(8),
866                    
867                    /** */
868                    EXTERNAL(9);
869                    
870                    private static final Map<Integer,IDENTITYTYPE> lookup = new HashMap<Integer,IDENTITYTYPE>();
871                    
872                    static {
873                            for(IDENTITYTYPE s : EnumSet.allOf(IDENTITYTYPE.class))
874                                    lookup.put(s.getId(), s);
875                    }
876                    
877                    private final int id;
878                    
879                    private IDENTITYTYPE(int value) {
880                            this.id = value;
881                    }
882                    
883                    public int getId() { return id; }
884                    
885                    public static IDENTITYTYPE get(int code) {
886                            return lookup.get(code);
887                    }
888                    
889                    public static IDENTITYTYPE fromString(String s) {
890                            for (IDENTITYTYPE p : lookup.values()) {
891                                    if (p.toString() == s) {
892                                            return p;
893                                    }
894                            }
895                            return null;
896                    }
897            }
898            
899            /**
900             *This takes skypename or a phone number string as argument and returns corresponding identity type (SKYPE, SKYPE_MYSELF, PSTN, etc.) <br>
901             * @param identity
902             * @return type
903             */
904            public IDENTITYTYPE GetIdentityType( String identity) {
905            
906                    Request request = null;
907                    try {
908                            request = new XCallRequest(0,19);
909                    } catch (IOException e) {
910                            e.printStackTrace();
911                            if (errorListener != null)
912                                    errorListener.OnSkypeKitFatalError();
913                    }
914                    request.addParm('S',1,identity);
915                    
916                    Response r = XCall((XCallRequest)request);
917                    
918                    if (r.isErrCall())
919                            return null;
920                            
921                    IDENTITYTYPE identitytype = null;
922                    identitytype = IDENTITYTYPE.get(r.GetAsInt(1));
923                    return identitytype;
924            }
925            
926            /**
927             */
928            public enum NORMALIZERESULT {
929            
930                    /** */
931                    IDENTITY_OK(0),
932                    
933                    /** */
934                    IDENTITY_EMPTY(1),
935                    
936                    /** */
937                    IDENTITY_TOO_LONG(2),
938                    
939                    /** */
940                    IDENTITY_CONTAINS_INVALID_CHAR(3),
941                    
942                    /** */
943                    PSTN_NUMBER_TOO_SHORT(4),
944                    
945                    /** identity looks like pstn number but does not start with +/00/011*/
946                    PSTN_NUMBER_HAS_INVALID_PREFIX(5),
947                    
948                    /** */
949                    SKYPENAME_STARTS_WITH_NONALPHA(6),
950                    
951                    /** returned only when isNewSkypeName*/
952                    SKYPENAME_SHORTER_THAN_6_CHARS(7);
953                    
954                    private static final Map<Integer,NORMALIZERESULT> lookup = new HashMap<Integer,NORMALIZERESULT>();
955                    
956                    static {
957                            for(NORMALIZERESULT s : EnumSet.allOf(NORMALIZERESULT.class))
958                                    lookup.put(s.getId(), s);
959                    }
960                    
961                    private final int id;
962                    
963                    private NORMALIZERESULT(int value) {
964                            this.id = value;
965                    }
966                    
967                    public int getId() { return id; }
968                    
969                    public static NORMALIZERESULT get(int code) {
970                            return lookup.get(code);
971                    }
972                    
973                    public static NORMALIZERESULT fromString(String s) {
974                            for (NORMALIZERESULT p : lookup.values()) {
975                                    if (p.toString() == s) {
976                                            return p;
977                                    }
978                            }
979                            return null;
980                    }
981            }
982            
983            /**
984             *compares two identities to see if they match
985             * @param identityA
986             * @param identityB
987             * @return result
988             */
989            public boolean IdentitiesMatch( String identityA, String identityB) {
990            
991                    Request request = null;
992                    try {
993                            request = new XCallRequest(0,88);
994                    } catch (IOException e) {
995                            e.printStackTrace();
996                            if (errorListener != null)
997                                    errorListener.OnSkypeKitFatalError();
998                    }
999                    request.addParm('S',1,identityA);
1000                    request.addParm('S',2,identityB);
1001                    
1002                    Response r = XCall((XCallRequest)request);
1003                    
1004                    if (r.isErrCall())
1005                            return false;
1006                            
1007                    boolean result = false;
1008                    result = r.GetAsBoolean(1);
1009                    return result;
1010            }
1011            
1012            /**
1013             *This method is deprecated. Use ValidateProfileString method instead. <br>
1014             * @param original
1015             * @param isNewSkypeName
1016             * @return NormalizeIdentityResult
1017             */
1018            public NormalizeIdentityResult NormalizeIdentity( String original, boolean isNewSkypeName) {
1019            
1020                    Request request = null;
1021                    try {
1022                            request = new XCallRequest(0,9);
1023                    } catch (IOException e) {
1024                            e.printStackTrace();
1025                            if (errorListener != null)
1026                                    errorListener.OnSkypeKitFatalError();
1027                    }
1028                    request.addParm('S',1,original);
1029                    request.addParm('b',2,isNewSkypeName);
1030                    
1031                    Response r = XCall((XCallRequest)request);
1032                    
1033                    if (r.isErrCall())
1034                            return null;
1035                            
1036                    NormalizeIdentityResult result = new NormalizeIdentityResult();
1037                    
1038                    NORMALIZERESULT normalizeresult = null;
1039                    normalizeresult = NORMALIZERESULT.get(r.GetAsInt(1));
1040                    result.result = normalizeresult;
1041                    
1042                    String normalized = null;
1043                    normalized = r.GetAsString(2);
1044                    result.normalized = normalized;
1045                    
1046                    return result;
1047            }
1048            
1049            public class NormalizeIdentityResult {
1050                    public NORMALIZERESULT result;
1051                    public String normalized;
1052            }
1053            
1054            /**
1055             *NormalizePSTNWithCountry checks if the phone number starts with + if it doesn't, it prefixes the output with +XXX (where XXX is the country code). It also converts letters to numbers based on the standard phone keypad, so that the phone number string 212CALLME1 with country code 372 (Estonia) would be normalized to +3722122255631. If the method cannot normalize the phone number (because it's too long, too short, etc.), it returns an error code in &result. <br>
1056             * @param original
1057             * @param countryPrefix
1058             * @return NormalizePSTNWithCountryResult
1059             */
1060            public NormalizePSTNWithCountryResult NormalizePSTNWithCountry( String original, int countryPrefix) {
1061            
1062                    Request request = null;
1063                    try {
1064                            request = new XCallRequest(0,205);
1065                    } catch (IOException e) {
1066                            e.printStackTrace();
1067                            if (errorListener != null)
1068                                    errorListener.OnSkypeKitFatalError();
1069                    }
1070                    request.addParm('S',1,original);
1071                    request.addParm('u',2,countryPrefix);
1072                    
1073                    Response r = XCall((XCallRequest)request);
1074                    
1075                    if (r.isErrCall())
1076                            return null;
1077                            
1078                    NormalizePSTNWithCountryResult result = new NormalizePSTNWithCountryResult();
1079                    
1080                    NORMALIZERESULT normalizeresult = null;
1081                    normalizeresult = NORMALIZERESULT.get(r.GetAsInt(1));
1082                    result.result = normalizeresult;
1083                    
1084                    String normalized = null;
1085                    normalized = r.GetAsString(2);
1086                    result.normalized = normalized;
1087                    
1088                    return result;
1089            }
1090            
1091            public class NormalizePSTNWithCountryResult {
1092                    public NORMALIZERESULT result;
1093                    public String normalized;
1094            }
1095            
1096            /**
1097             *list of (min,max) pairs
1098             * @return rangeList
1099             */
1100            public int [] GetOptimalAgeRanges() {
1101            
1102                    Request request = null;
1103                    try {
1104                            request = new XCallRequest(0,77);
1105                    } catch (IOException e) {
1106                            e.printStackTrace();
1107                            if (errorListener != null)
1108                                    errorListener.OnSkypeKitFatalError();
1109                    }
1110                    
1111                    Response r = XCall((XCallRequest)request);
1112                    
1113                    if (r.isErrCall())
1114                            return null;
1115                            
1116                    Vector<Integer> rangeList = new Vector<Integer>();
1117                    while (r.HasMore(1))
1118                    {
1119                            Integer integer = null;
1120                            integer = new Integer(r.GetAsInt(1));
1121                            rangeList.add(integer);
1122                    }
1123                    
1124                    int[] intArray = new int[rangeList.size()];
1125                    for (int i = 0; i < rangeList.size(); i++) {
1126                            intArray[i] = rangeList.get(i);
1127                    }
1128                    return intArray;
1129            }
1130            
1131            /**
1132             *Creates a blank contact search object, in which you can add your custom search terms. For more information how asynchronous contact search works, see ContactSearch class details. <br>
1133             * @return search Returns blank ContactSearch object. <br>
1134             */
1135            public ContactSearch CreateContactSearch() {
1136            
1137                    Request request = null;
1138                    try {
1139                            request = new XCallRequest(0,10);
1140                    } catch (IOException e) {
1141                            e.printStackTrace();
1142                            if (errorListener != null)
1143                                    errorListener.OnSkypeKitFatalError();
1144                    }
1145                    
1146                    Response r = XCall((XCallRequest)request);
1147                    
1148                    if (r.isErrCall())
1149                            return null;
1150                            
1151                    int oid = 0;
1152                    ContactSearch search = null;
1153                    oid = r.GetOid(1);
1154                    if (oid != AbstractDecoder.NULL_VALUE) {
1155                            search = (ContactSearch)skype.factory(ContactSearch.moduleID(), oid, skype);
1156                    }
1157                    return search;
1158            }
1159            
1160            /**
1161             *searches skypenames, aliases, fullnames, emails. false if not valid
1162             * @param text
1163             * @return search
1164             */
1165            public ContactSearch CreateBasicContactSearch( String text) {
1166            
1167                    Request request = null;
1168                    try {
1169                            request = new XCallRequest(0,11);
1170                    } catch (IOException e) {
1171                            e.printStackTrace();
1172                            if (errorListener != null)
1173                                    errorListener.OnSkypeKitFatalError();
1174                    }
1175                    request.addParm('S',1,text);
1176                    
1177                    Response r = XCall((XCallRequest)request);
1178                    
1179                    if (r.isErrCall())
1180                            return null;
1181                            
1182                    int oid = 0;
1183                    ContactSearch search = null;
1184                    oid = r.GetOid(1);
1185                    if (oid != AbstractDecoder.NULL_VALUE) {
1186                            search = (ContactSearch)skype.factory(ContactSearch.moduleID(), oid, skype);
1187                    }
1188                    return search;
1189            }
1190            
1191            /**
1192             *searches skypenames and aliases. returns 0 or 1 results. false if not valid
1193             * @param identity
1194             * @return search
1195             */
1196            public ContactSearch CreateIdentitySearch( String identity) {
1197            
1198                    Request request = null;
1199                    try {
1200                            request = new XCallRequest(0,12);
1201                    } catch (IOException e) {
1202                            e.printStackTrace();
1203                            if (errorListener != null)
1204                                    errorListener.OnSkypeKitFatalError();
1205                    }
1206                    request.addParm('S',1,identity);
1207                    
1208                    Response r = XCall((XCallRequest)request);
1209                    
1210                    if (r.isErrCall())
1211                            return null;
1212                            
1213                    int oid = 0;
1214                    ContactSearch search = null;
1215                    oid = r.GetOid(1);
1216                    if (oid != AbstractDecoder.NULL_VALUE) {
1217                            search = (ContactSearch)skype.factory(ContactSearch.moduleID(), oid, skype);
1218                    }
1219                    return search;
1220            }
1221            
1222            /**
1223            sync failure reasons when starting a transfer */
1224            public enum TRANSFER_SENDFILE_ERROR {
1225            
1226                    /** */
1227                    TRANSFER_OPEN_SUCCESS(0),
1228                    
1229                    /** */
1230                    TRANSFER_BAD_FILENAME(1),
1231                    
1232                    /** */
1233                    TRANSFER_OPEN_FAILED(2),
1234                    
1235                    /** */
1236                    TRANSFER_TOO_MANY_PARALLEL(3);
1237                    
1238                    private static final Map<Integer,TRANSFER_SENDFILE_ERROR> lookup = new HashMap<Integer,TRANSFER_SENDFILE_ERROR>();
1239                    
1240                    static {
1241                            for(TRANSFER_SENDFILE_ERROR s : EnumSet.allOf(TRANSFER_SENDFILE_ERROR.class))
1242                                    lookup.put(s.getId(), s);
1243                    }
1244                    
1245                    private final int id;
1246                    
1247                    private TRANSFER_SENDFILE_ERROR(int value) {
1248                            this.id = value;
1249                    }
1250                    
1251                    public int getId() { return id; }
1252                    
1253                    public static TRANSFER_SENDFILE_ERROR get(int code) {
1254                            return lookup.get(code);
1255                    }
1256                    
1257                    public static TRANSFER_SENDFILE_ERROR fromString(String s) {
1258                            for (TRANSFER_SENDFILE_ERROR p : lookup.values()) {
1259                                    if (p.toString() == s) {
1260                                            return p;
1261                                    }
1262                            }
1263                            return null;
1264                    }
1265            }
1266            
1267            /**
1268             */
1269            public enum LEAVE_REASON {
1270            
1271                    /** */
1272                    LEAVE_REASON_NONE(0),
1273                    
1274                    /** automatic, user cannot chat (only some older versions might set this)*/
1275                    RETIRED_USER_INCAPABLE(2),
1276                    
1277                    /** automatic*/
1278                    RETIRED_ADDER_MUST_BE_FRIEND(3),
1279                    
1280                    /** automatic*/
1281                    RETIRED_ADDER_MUST_BE_AUTHORIZED(4),
1282                    
1283                    /** manual reason (afaik no UI uses this)*/
1284                    RETIRED_DECLINE_ADD(5),
1285                    
1286                    /** manual reason*/
1287                    RETIRED_UNSUBSCRIBE(6),
1288                    
1289                    /** */
1290                    LIVE_NO_ANSWER(100),
1291                    
1292                    /** live: User hung up*/
1293                    LIVE_MANUAL(101),
1294                    
1295                    /** */
1296                    LIVE_BUSY(102),
1297                    
1298                    /** */
1299                    LIVE_CONNECTION_DROPPED(103),
1300                    
1301                    /** */
1302                    LIVE_NO_SKYPEOUT_SUBSCRIPTION(104),
1303                    
1304                    /** */
1305                    LIVE_INSUFFICIENT_FUNDS(105),
1306                    
1307                    /** */
1308                    LIVE_INTERNET_CONNECTION_LOST(106),
1309                    
1310                    /** */
1311                    LIVE_SKYPEOUT_ACCOUNT_BLOCKED(107),
1312                    
1313                    /** */
1314                    LIVE_PSTN_COULD_NOT_CONNECT_TO_SKYPE_PROXY(108),
1315                    
1316                    /** */
1317                    LIVE_PSTN_INVALID_NUMBER(109),
1318                    
1319                    /** */
1320                    LIVE_PSTN_NUMBER_FORBIDDEN(110),
1321                    
1322                    /** */
1323                    LIVE_PSTN_CALL_TIMED_OUT(111),
1324                    
1325                    /** */
1326                    LIVE_PSTN_BUSY(112),
1327                    
1328                    /** */
1329                    LIVE_PSTN_CALL_TERMINATED(113),
1330                    
1331                    /** */
1332                    LIVE_PSTN_NETWORK_ERROR(114),
1333                    
1334                    /** */
1335                    LIVE_NUMBER_UNAVAILABLE(115),
1336                    
1337                    /** */
1338                    LIVE_PSTN_CALL_REJECTED(116),
1339                    
1340                    /** */
1341                    LIVE_PSTN_MISC_ERROR(117),
1342                    
1343                    /** */
1344                    LIVE_INTERNAL_ERROR(118),
1345                    
1346                    /** */
1347                    LIVE_UNABLE_TO_CONNECT(119),
1348                    
1349                    /** live: Voicemail recording failed*/
1350                    LIVE_RECORDING_FAILED(120),
1351                    
1352                    /** live: Voicemail playback failed*/
1353                    LIVE_PLAYBACK_ERROR(121),
1354                    
1355                    /** */
1356                    LIVE_LEGACY_ERROR(122),
1357                    
1358                    /** */
1359                    LIVE_BLOCKED_BY_PRIVACY_SETTINGS(123),
1360                    
1361                    /** live: Fallback error*/
1362                    LIVE_ERROR(124),
1363                    
1364                    /** */
1365                    LIVE_TRANSFER_FAILED(125),
1366                    
1367                    /** */
1368                    LIVE_TRANSFER_INSUFFICIENT_FUNDS(126),
1369                    
1370                    /** */
1371                    LIVE_BLOCKED_BY_US(127),
1372                    
1373                    /** */
1374                    LIVE_EMERGENCY_CALL_DENIED(128);
1375                    
1376                    private static final Map<Integer,LEAVE_REASON> lookup = new HashMap<Integer,LEAVE_REASON>();
1377                    
1378                    static {
1379                            for(LEAVE_REASON s : EnumSet.allOf(LEAVE_REASON.class))
1380                                    lookup.put(s.getId(), s);
1381                    }
1382                    
1383                    private final int id;
1384                    
1385                    private LEAVE_REASON(int value) {
1386                            this.id = value;
1387                    }
1388                    
1389                    public int getId() { return id; }
1390                    
1391                    public static LEAVE_REASON get(int code) {
1392                            return lookup.get(code);
1393                    }
1394                    
1395                    public static LEAVE_REASON fromString(String s) {
1396                            for (LEAVE_REASON p : lookup.values()) {
1397                                    if (p.toString() == s) {
1398                                            return p;
1399                                    }
1400                            }
1401                            return null;
1402                    }
1403            }
1404            
1405            /**
1406             *Creates a new empty conversation object and returns a reference to it. <br>
1407             * @return conference
1408             */
1409            public Conversation CreateConference() {
1410            
1411                    Request request = null;
1412                    try {
1413                            request = new XCallRequest(0,13);
1414                    } catch (IOException e) {
1415                            e.printStackTrace();
1416                            if (errorListener != null)
1417                                    errorListener.OnSkypeKitFatalError();
1418                    }
1419                    
1420                    Response r = XCall((XCallRequest)request);
1421                    
1422                    if (r.isErrCall())
1423                            return null;
1424                            
1425                    int oid = 0;
1426                    Conversation conference = null;
1427                    oid = r.GetOid(1);
1428                    if (oid != AbstractDecoder.NULL_VALUE) {
1429                            conference = (Conversation)skype.factory(Conversation.moduleID(), oid, skype);
1430                    }
1431                    return conference;
1432            }
1433            
1434            /**
1435             *Returns reference tp conversation object by conversation ID string (equivalent of old chat ID). NB! ID here is that of conversation, rather than skypename of dialog partner. If you want to retrieve a conversation object with any particular person, then Skype class GetConversationByParticipants method is what you are looking for. <br>
1436             * @param convoIdentity
1437             * @return conversation
1438             */
1439            public Conversation GetConversationByIdentity( String convoIdentity) {
1440            
1441                    Request request = null;
1442                    try {
1443                            request = new XCallRequest(0,15);
1444                    } catch (IOException e) {
1445                            e.printStackTrace();
1446                            if (errorListener != null)
1447                                    errorListener.OnSkypeKitFatalError();
1448                    }
1449                    request.addParm('S',1,convoIdentity);
1450                    
1451                    Response r = XCall((XCallRequest)request);
1452                    
1453                    if (r.isErrCall())
1454                            return null;
1455                            
1456                    int oid = 0;
1457                    Conversation conversation = null;
1458                    oid = r.GetOid(1);
1459                    if (oid != AbstractDecoder.NULL_VALUE) {
1460                            conversation = (Conversation)skype.factory(Conversation.moduleID(), oid, skype);
1461                    }
1462                    return conversation;
1463            }
1464            
1465            /**
1466             *myself not included
1467             * @param participantIdentities
1468             * @param createIfNonExisting
1469             * @param ignoreBookmarkedOrNamed
1470             * @return conversation
1471             */
1472            public Conversation GetConversationByParticipants( String [] participantIdentities, boolean createIfNonExisting, boolean ignoreBookmarkedOrNamed) {
1473            
1474                    Request request = null;
1475                    try {
1476                            request = new XCallRequest(0,16);
1477                    } catch (IOException e) {
1478                            e.printStackTrace();
1479                            if (errorListener != null)
1480                                    errorListener.OnSkypeKitFatalError();
1481                    }
1482                    request.addListStart(1);
1483                    for (int i=0;i<participantIdentities.length;i++) {
1484                            request.addParm('S',participantIdentities[i]);
1485                    }
1486                    request.addParm('b',2,createIfNonExisting);
1487                    request.addParm('b',3,ignoreBookmarkedOrNamed);
1488                    
1489                    Response r = XCall((XCallRequest)request);
1490                    
1491                    if (r.isErrCall())
1492                            return null;
1493                            
1494                    int oid = 0;
1495                    Conversation conversation = null;
1496                    oid = r.GetOid(1);
1497                    if (oid != AbstractDecoder.NULL_VALUE) {
1498                            conversation = (Conversation)skype.factory(Conversation.moduleID(), oid, skype);
1499                    }
1500                    return conversation;
1501            }
1502            
1503            /**
1504             *Retrieves a Conversation object by Public Conversation BLOB. Public conversation blobs are globally unique conversation IDs that provide a method for joining conversation without explicitly being added to the conversation by someone already in it. Programmatically, a Conversation BLOB can be retrieved with Conversation.GetJoinBlob method. In Skype desktop clients, the BLOB can be retrieved by typing "/get uri" in a conversation. The conversation can then be joined by people who have somehow received that BLOB. <br>
1505             * @param joinBlob The BLOB string. <br>
1506             * @param alsoJoin If set to true, automatically joins current user into the Conversation. <br>
1507             * @return conversation Returns Conversation object if successful. <br>
1508             */
1509            public Conversation GetConversationByBlob( String joinBlob, boolean alsoJoin) {
1510            
1511                    Request request = null;
1512                    try {
1513                            request = new XCallRequest(0,17);
1514                    } catch (IOException e) {
1515                            e.printStackTrace();
1516                            if (errorListener != null)
1517                                    errorListener.OnSkypeKitFatalError();
1518                    }
1519                    request.addParm('S',1,joinBlob);
1520                    request.addParm('b',2,alsoJoin);
1521                    
1522                    Response r = XCall((XCallRequest)request);
1523                    
1524                    if (r.isErrCall())
1525                            return null;
1526                            
1527                    int oid = 0;
1528                    Conversation conversation = null;
1529                    oid = r.GetOid(1);
1530                    if (oid != AbstractDecoder.NULL_VALUE) {
1531                            conversation = (Conversation)skype.factory(Conversation.moduleID(), oid, skype);
1532                    }
1533                    return conversation;
1534            }
1535            
1536            /**
1537             *Returns a list of Conversation objects by Conversation.LIST_TYPE filter. <br>
1538             * @param type Filter. <br>
1539             * @return conversations List of conversations matching the filter. <br>
1540             */
1541            public Conversation [] GetConversationList( Conversation.LIST_TYPE type) {
1542            
1543                    Request request = null;
1544                    try {
1545                            request = new XCallRequest(0,18);
1546                    } catch (IOException e) {
1547                            e.printStackTrace();
1548                            if (errorListener != null)
1549                                    errorListener.OnSkypeKitFatalError();
1550                    }
1551                    request.addParm('e',1,type.getId());
1552                    
1553                    Response r = XCall((XCallRequest)request);
1554                    
1555                    if (r.isErrCall())
1556                            return null;
1557                            
1558                    Vector<Conversation> conversations = new Vector<Conversation>();
1559                    while (r.HasMore(1))
1560                    {
1561                            int oid = 0;
1562                            Conversation conversation = null;
1563                            oid = r.GetOid(1);
1564                            if (oid != AbstractDecoder.NULL_VALUE) { 
1565                                    conversation = (Conversation)skype.factory(Conversation.moduleID(), oid, skype);
1566                            }
1567                            conversations.add(conversation);
1568                    }
1569                    return conversations.toArray(new Conversation[conversations.size()]);
1570                    
1571            }
1572            
1573            /**
1574             *Retrieves a Message object by the P_GUID property (globally unique ID, same for all the participants of the conversation, in which this message occured). <br>
1575             * @param guid Globally unique ID of the message. <br>
1576             * @return message Returns a Message object if a match was found. <br>
1577             */
1578            public Message GetMessageByGuid( byte[] guid) {
1579            
1580                    Request request = null;
1581                    try {
1582                            request = new XCallRequest(0,21);
1583                    } catch (IOException e) {
1584                            e.printStackTrace();
1585                            if (errorListener != null)
1586                                    errorListener.OnSkypeKitFatalError();
1587                    }
1588                    request.addParm('B',1,guid);
1589                    
1590                    Response r = XCall((XCallRequest)request);
1591                    
1592                    if (r.isErrCall())
1593                            return null;
1594                            
1595                    int oid = 0;
1596                    Message message = null;
1597                    oid = r.GetOid(1);
1598                    if (oid != AbstractDecoder.NULL_VALUE) {
1599                            message = (Message)skype.factory(Message.moduleID(), oid, skype);
1600                    }
1601                    return message;
1602            }
1603            
1604            /**
1605             *Returns all messages of the given type
1606             * @param type Type of messages requested. For POSTED_TEXT or POSTED_EMOTE, returns a list with both types
1607             * @param latestPerConvOnly Whether to return only the most recent message per conversation
1608             * @param fromTimestampInc Starting timestamp for reqested range, inclusive
1609             * @param toTimestampExc Ending timestamp for requested range, exclusive
1610             * @return messages
1611             */
1612            public Message [] GetMessageListByType( Message.TYPE type, boolean latestPerConvOnly, int fromTimestampInc, int toTimestampExc) {
1613            
1614                    Request request = null;
1615                    try {
1616                            request = new XCallRequest(0,136);
1617                    } catch (IOException e) {
1618                            e.printStackTrace();
1619                            if (errorListener != null)
1620                                    errorListener.OnSkypeKitFatalError();
1621                    }
1622                    request.addParm('e',1,type.getId());
1623                    request.addParm('b',2,latestPerConvOnly);
1624                    request.addParm('u',3,fromTimestampInc);
1625                    request.addParm('u',4,toTimestampExc);
1626                    
1627                    Response r = XCall((XCallRequest)request);
1628                    
1629                    if (r.isErrCall())
1630                            return null;
1631                            
1632                    Vector<Message> messages = new Vector<Message>();
1633                    while (r.HasMore(1))
1634                    {
1635                            int oid = 0;
1636                            Message message = null;
1637                            oid = r.GetOid(1);
1638                            if (oid != AbstractDecoder.NULL_VALUE) { 
1639                                    message = (Message)skype.factory(Message.moduleID(), oid, skype);
1640                            }
1641                            messages.add(message);
1642                    }
1643                    return messages.toArray(new Message[messages.size()]);
1644                    
1645            }
1646            
1647            /**
1648             *This method returns a table in form of two string lists of equal length and an uint argument that returns the count of items i both lists. The first list contains video recording device handles and the second list descriptive names of those devices. NB! This method requires videortphost to be running, otherwise it will return empty lists. <br>
1649             * @return GetAvailableVideoDevicesResult
1650             */
1651            public GetAvailableVideoDevicesResult GetAvailableVideoDevices() {
1652            
1653                    Request request = null;
1654                    try {
1655                            request = new XCallRequest(0,80);
1656                    } catch (IOException e) {
1657                            e.printStackTrace();
1658                            if (errorListener != null)
1659                                    errorListener.OnSkypeKitFatalError();
1660                    }
1661                    
1662                    Response r = XCall((XCallRequest)request);
1663                    
1664                    if (r.isErrCall())
1665                            return null;
1666                            
1667                    GetAvailableVideoDevicesResult result = new GetAvailableVideoDevicesResult();
1668                    
1669                    Vector<String> deviceNames = new Vector<String>();
1670                    while (r.HasMore(1))
1671                    {
1672                            String string = null;
1673                            string  = r.GetAsString(1);
1674                            deviceNames.add(string);
1675                    }
1676                    result.deviceNames = deviceNames.toArray(new String[deviceNames.size()]);
1677                    
1678                    Vector<String> devicePaths = new Vector<String>();
1679                    while (r.HasMore(2))
1680                    {
1681                            String string = null;
1682                            string  = r.GetAsString(2);
1683                            devicePaths.add(string);
1684                    }
1685                    result.devicePaths = devicePaths.toArray(new String[devicePaths.size()]);
1686                    
1687                    int count = 0;
1688                    count = r.GetAsInt(3);
1689                    result.count = count;
1690                    
1691                    return result;
1692            }
1693            
1694            public class GetAvailableVideoDevicesResult {
1695                    public String [] deviceNames;
1696                    public String [] devicePaths;
1697                    public int count;
1698            }
1699            
1700            /**
1701             *Queries whether the given video device has a specific Video.VIDEO_DEVICE_CAPABILITY. Use Skype.GetAvailableVideoDevices method to retrieve sstring lists with available deviceName and devicePath values. <br>
1702             * @param deviceName Human readable device name. <br>
1703             * @param devicePath Device ID. <br>
1704             * @param cap Any of the Video.VIDEO_DEVICE_CAPABILITY values. <br>
1705             * @return result
1706             */
1707            public boolean HasVideoDeviceCapability( String deviceName, String devicePath, Video.VIDEO_DEVICE_CAPABILITY cap) {
1708            
1709                    Request request = null;
1710                    try {
1711                            request = new XCallRequest(0,33);
1712                    } catch (IOException e) {
1713                            e.printStackTrace();
1714                            if (errorListener != null)
1715                                    errorListener.OnSkypeKitFatalError();
1716                    }
1717                    request.addParm('S',1,deviceName);
1718                    request.addParm('S',2,devicePath);
1719                    request.addParm('e',3,cap.getId());
1720                    
1721                    Response r = XCall((XCallRequest)request);
1722                    
1723                    if (r.isErrCall())
1724                            return false;
1725                            
1726                    boolean result = false;
1727                    result = r.GetAsBoolean(1);
1728                    return result;
1729            }
1730            
1731            /**
1732             * @param deviceName
1733             * @param devicePath
1734             */
1735            public void DisplayVideoDeviceTuningDialog( String deviceName, String devicePath) {
1736            
1737                    Request request = null;
1738                    try {
1739                            request = new XCallRequest(0,34);
1740                    } catch (IOException e) {
1741                            e.printStackTrace();
1742                            if (errorListener != null)
1743                                    errorListener.OnSkypeKitFatalError();
1744                    }
1745                    request.addParm('S',1,deviceName);
1746                    request.addParm('S',2,devicePath);
1747                    
1748                    XCall((XCallRequest)request);
1749            }
1750            
1751            /**
1752             *Warning: Will be deprecated soon
1753             * @param type
1754             * @param deviceName name and path to be used only with media type VIDEO
1755             * @param devicePath
1756             * @return video
1757             */
1758            public Video GetPreviewVideo( Video.MEDIATYPE type, String deviceName, String devicePath) {
1759            
1760                    Request request = null;
1761                    try {
1762                            request = new XCallRequest(0,35);
1763                    } catch (IOException e) {
1764                            e.printStackTrace();
1765                            if (errorListener != null)
1766                                    errorListener.OnSkypeKitFatalError();
1767                    }
1768                    request.addParm('e',1,type.getId());
1769                    request.addParm('S',2,deviceName);
1770                    request.addParm('S',3,devicePath);
1771                    
1772                    Response r = XCall((XCallRequest)request);
1773                    
1774                    if (r.isErrCall())
1775                            return null;
1776                            
1777                    int oid = 0;
1778                    Video video = null;
1779                    oid = r.GetOid(1);
1780                    if (oid != AbstractDecoder.NULL_VALUE) {
1781                            video = (Video)skype.factory(Video.moduleID(), oid, skype);
1782                    }
1783                    return video;
1784            }
1785            
1786            /**
1787             *Avaible to Video Engines using the Video RTP API
1788             * @param command
1789             * @return response
1790             */
1791            public String VideoCommand( String command) {
1792            
1793                    Request request = null;
1794                    try {
1795                            request = new XCallRequest(0,59);
1796                    } catch (IOException e) {
1797                            e.printStackTrace();
1798                            if (errorListener != null)
1799                                    errorListener.OnSkypeKitFatalError();
1800                    }
1801                    request.addParm('S',1,command);
1802                    
1803                    Response r = XCall((XCallRequest)request);
1804                    
1805                    if (r.isErrCall())
1806                            return null;
1807                            
1808                    String response = null;
1809                    response = r.GetAsString(1);
1810                    return response;
1811            }
1812            
1813            /**
1814             */
1815            public enum QUALITYTESTTYPE {
1816            
1817                    /** */
1818                    QTT_AUDIO_IN(0),
1819                    
1820                    /** */
1821                    QTT_AUDIO_OUT(1),
1822                    
1823                    /** */
1824                    QTT_VIDEO_OUT(2),
1825                    
1826                    /** */
1827                    QTT_CPU(3),
1828                    
1829                    /** */
1830                    QTT_NETWORK(4),
1831                    
1832                    /** */
1833                    QTT_VIDEO_IN(5);
1834                    
1835                    private static final Map<Integer,QUALITYTESTTYPE> lookup = new HashMap<Integer,QUALITYTESTTYPE>();
1836                    
1837                    static {
1838                            for(QUALITYTESTTYPE s : EnumSet.allOf(QUALITYTESTTYPE.class))
1839                                    lookup.put(s.getId(), s);
1840                    }
1841                    
1842                    private final int id;
1843                    
1844                    private QUALITYTESTTYPE(int value) {
1845                            this.id = value;
1846                    }
1847                    
1848                    public int getId() { return id; }
1849                    
1850                    public static QUALITYTESTTYPE get(int code) {
1851                            return lookup.get(code);
1852                    }
1853                    
1854                    public static QUALITYTESTTYPE fromString(String s) {
1855                            for (QUALITYTESTTYPE p : lookup.values()) {
1856                                    if (p.toString() == s) {
1857                                            return p;
1858                                    }
1859                            }
1860                            return null;
1861                    }
1862            }
1863            
1864            /**
1865             */
1866            public enum QUALITYTESTRESULT {
1867            
1868                    /** */
1869                    QTR_UNDEFINED(0),
1870                    
1871                    /** */
1872                    QTR_CRITICAL(1),
1873                    
1874                    /** */
1875                    QTR_POOR(2),
1876                    
1877                    /** */
1878                    QTR_AVERAGE(3),
1879                    
1880                    /** */
1881                    QTR_GOOD(4),
1882                    
1883                    /** */
1884                    QTR_EXCELLENT(5);
1885                    
1886                    private static final Map<Integer,QUALITYTESTRESULT> lookup = new HashMap<Integer,QUALITYTESTRESULT>();
1887                    
1888                    static {
1889                            for(QUALITYTESTRESULT s : EnumSet.allOf(QUALITYTESTRESULT.class))
1890                                    lookup.put(s.getId(), s);
1891                    }
1892                    
1893                    private final int id;
1894                    
1895                    private QUALITYTESTRESULT(int value) {
1896                            this.id = value;
1897                    }
1898                    
1899                    public int getId() { return id; }
1900                    
1901                    public static QUALITYTESTRESULT get(int code) {
1902                            return lookup.get(code);
1903                    }
1904                    
1905                    public static QUALITYTESTRESULT fromString(String s) {
1906                            for (QUALITYTESTRESULT p : lookup.values()) {
1907                                    if (p.toString() == s) {
1908                                            return p;
1909                                    }
1910                            }
1911                            return null;
1912                    }
1913            }
1914            
1915            /**
1916             * @param withUser if empty, network test results would reflect status of local node only
1917             * @param excludeNetworkTest
1918             */
1919            public void StartMonitoringQuality( String withUser, boolean excludeNetworkTest) {
1920            
1921                    Request request = null;
1922                    try {
1923                            request = new XCallRequest(0,140);
1924                    } catch (IOException e) {
1925                            e.printStackTrace();
1926                            if (errorListener != null)
1927                                    errorListener.OnSkypeKitFatalError();
1928                    }
1929                    request.addParm('S',1,withUser);
1930                    request.addParm('b',2,excludeNetworkTest);
1931                    
1932                    XCall((XCallRequest)request);
1933            }
1934            
1935            /**
1936             * @param withUser
1937             * @param justStop
1938             * @return result
1939             */
1940            public QUALITYTESTRESULT StopMonitoringQuality( String withUser, boolean justStop) {
1941            
1942                    Request request = null;
1943                    try {
1944                            request = new XCallRequest(0,141);
1945                    } catch (IOException e) {
1946                            e.printStackTrace();
1947                            if (errorListener != null)
1948                                    errorListener.OnSkypeKitFatalError();
1949                    }
1950                    request.addParm('S',1,withUser);
1951                    request.addParm('b',2,justStop);
1952                    
1953                    Response r = XCall((XCallRequest)request);
1954                    
1955                    if (r.isErrCall())
1956                            return null;
1957                            
1958                    QUALITYTESTRESULT qualitytestresult = null;
1959                    qualitytestresult = QUALITYTESTRESULT.get(r.GetAsInt(1));
1960                    return qualitytestresult;
1961            }
1962            
1963            /**
1964             * @param skypeName
1965             * @return greeting
1966             */
1967            public Voicemail GetGreeting( String skypeName) {
1968            
1969                    Request request = null;
1970                    try {
1971                            request = new XCallRequest(0,45);
1972                    } catch (IOException e) {
1973                            e.printStackTrace();
1974                            if (errorListener != null)
1975                                    errorListener.OnSkypeKitFatalError();
1976                    }
1977                    request.addParm('S',1,skypeName);
1978                    
1979                    Response r = XCall((XCallRequest)request);
1980                    
1981                    if (r.isErrCall())
1982                            return null;
1983                            
1984                    int oid = 0;
1985                    Voicemail greeting = null;
1986                    oid = r.GetOid(1);
1987                    if (oid != AbstractDecoder.NULL_VALUE) {
1988                            greeting = (Voicemail)skype.factory(Voicemail.moduleID(), oid, skype);
1989                    }
1990                    return greeting;
1991            }
1992            
1993            /** Setupkey SETUPKEY_DISABLED_CODECS type:string  <br>Space-separated array of disabled codecs <br>This setup key is machine-specific and affects all local accounts. <br> */
1994            public static final String DISABLED_CODECS = "*Lib/Audio/DisableCodecs";
1995            
1996            /** Setupkey SETUPKEY_DISABLE_AEC type:boolean  <br>Disables Skype echo canceller <br>This setup key is machine-specific and affects all local accounts. <br> */
1997            public static final String DISABLE_AEC = "*Lib/Audio/DisableAEC";
1998            
1999            /** Setupkey SETUPKEY_DISABLE_NOISE_SUPPRESSOR type:boolean  <br>Disables Skype noise suppressor <br>This setup key is machine-specific and affects all local accounts. <br> */
2000            public static final String DISABLE_NOISE_SUPPRESSOR = "*Lib/Audio/DisableNS";
2001            
2002            /** Setupkey SETUPKEY_DISABLE_AGC type:boolean  Disables Skype automatic gain controller <br>This setup key is machine-specific and affects all local accounts. <br> */
2003            public static final String DISABLE_AGC = "*Lib/Audio/DisableAGC";
2004            
2005            /** Setupkey SETUPKEY_DISABLE_DIGITAL_NEAR_END_AGC type:boolean  <br>Disables Skype digital near-end gain controller <br>This setup key is machine-specific and affects all local accounts. <br> */
2006            public static final String DISABLE_DIGITAL_NEAR_END_AGC = "*Lib/Audio/DisableDigitalNearEndAGC";
2007            
2008            /** Setupkey SETUPKEY_DISABLE_DIGITAL_FAR_END_AGC type:boolean  <br>Disables Skype digital far-end gain controller <br>This setup key is machine-specific and affects all local accounts. <br> */
2009            public static final String DISABLE_DIGITAL_FAR_END_AGC = "*Lib/Audio/DisableDigitalFarEndAGC";
2010            
2011            /** Setupkey SETUPKEY_BEAMFORMER_MIC_SPACING type:string  <br>Space-separated array of 1 (in case of 2 microphones) or 2 (in case of 4 microphones) integers. SAL beamforming currently only supports 2 and 4-microphone configurations. The values represent the spacing between microphones (in millimeters). <br>In case of 2-microphone setup, Only the first value is used. <br><br>In case of 4-microphone setup, The first value is the distance between inner pair of microphones. The second value is the distance between inner pair of microphones and the outer pair. Like this: <br><br>Let the microphones be on straight line, A B C D. <br>Microphones B and C form the inner pair, while A and D form the outer pair. <br>The first value in the setup string would be distance between B and C. <br>The second value would be distance between A and B (which is the same as distance between C and D). <br><br>With 4-mic setup, you will need to use two channels. The inner pair should go to one channel (left) and the outer pair should go to another (right). <br><br>This setup key is machine-specific and affects all local accounts. <br> */
2012            public static final String BEAMFORMER_MIC_SPACING = "*Lib/Audio/BeamformerMicSpacing";
2013            
2014            /** Setupkey SETUPKEY_DISABLE_AUDIO_DEVICE_PROBING type:boolean  <br>Disables audio devices probing <br>This setup key is machine-specific and affects all local accounts. <br> */
2015            public static final String DISABLE_AUDIO_DEVICE_PROBING = "*Lib/QualityMonitor/DisableAudioDeviceProbing";
2016            
2017            /**
2018             */
2019            public enum PREPARESOUNDRESULT {
2020            
2021                    /** */
2022                    PREPARESOUND_SUCCESS(0),
2023                    
2024                    /** */
2025                    PREPARESOUND_MISC_ERROR(1),
2026                    
2027                    /** */
2028                    PREPARESOUND_FILE_NOT_FOUND(2),
2029                    
2030                    /** */
2031                    PREPARESOUND_FILE_TOO_BIG(3),
2032                    
2033                    /** */
2034                    PREPARESOUND_FILE_READ_ERROR(4),
2035                    
2036                    /** */
2037                    PREPARESOUND_UNSUPPORTED_FILE_FORMAT(5),
2038                    
2039                    /** */
2040                    PREPARESOUND_PLAYBACK_NOT_SUPPORTED(6);
2041                    
2042                    private static final Map<Integer,PREPARESOUNDRESULT> lookup = new HashMap<Integer,PREPARESOUNDRESULT>();
2043                    
2044                    static {
2045                            for(PREPARESOUNDRESULT s : EnumSet.allOf(PREPARESOUNDRESULT.class))
2046                                    lookup.put(s.getId(), s);
2047                    }
2048                    
2049                    private final int id;
2050                    
2051                    private PREPARESOUNDRESULT(int value) {
2052                            this.id = value;
2053                    }
2054                    
2055                    public int getId() { return id; }
2056                    
2057                    public static PREPARESOUNDRESULT get(int code) {
2058                            return lookup.get(code);
2059                    }
2060                    
2061                    public static PREPARESOUNDRESULT fromString(String s) {
2062                            for (PREPARESOUNDRESULT p : lookup.values()) {
2063                                    if (p.toString() == s) {
2064                                            return p;
2065                                    }
2066                            }
2067                            return null;
2068                    }
2069            }
2070            
2071            /**
2072             */
2073            public enum AUDIODEVICE_CAPABILITIES {
2074            
2075                    /** */
2076                    HAS_VIDEO_CAPTURE(1),
2077                    
2078                    /** */
2079                    HAS_USB_INTERFACE(2),
2080                    
2081                    /** */
2082                    POSSIBLY_HEADSET(4),
2083                    
2084                    /** */
2085                    HAS_AUDIO_CAPTURE(8),
2086                    
2087                    /** */
2088                    HAS_AUDIO_RENDERING(16),
2089                    
2090                    /** */
2091                    HAS_LOWBANDWIDTH_CAPTURE(32),
2092                    
2093                    /** */
2094                    IS_WEBCAM(64),
2095                    
2096                    /** */
2097                    IS_HEADSET(128),
2098                    
2099                    /** */
2100                    POSSIBLY_WEBCAM(256),
2101                    
2102                    /** */
2103                    HAS_VIDEO_RENDERING(2048),
2104                    
2105                    /** */
2106                    HAS_BLUETOOTH_INTERFACE(4096);
2107                    
2108                    private static final Map<Integer,AUDIODEVICE_CAPABILITIES> lookup = new HashMap<Integer,AUDIODEVICE_CAPABILITIES>();
2109                    
2110                    static {
2111                            for(AUDIODEVICE_CAPABILITIES s : EnumSet.allOf(AUDIODEVICE_CAPABILITIES.class))
2112                                    lookup.put(s.getId(), s);
2113                    }
2114                    
2115                    private final int id;
2116                    
2117                    private AUDIODEVICE_CAPABILITIES(int value) {
2118                            this.id = value;
2119                    }
2120                    
2121                    public int getId() { return id; }
2122                    
2123                    public static AUDIODEVICE_CAPABILITIES get(int code) {
2124                            return lookup.get(code);
2125                    }
2126                    
2127                    public static AUDIODEVICE_CAPABILITIES fromString(String s) {
2128                            for (AUDIODEVICE_CAPABILITIES p : lookup.values()) {
2129                                    if (p.toString() == s) {
2130                                            return p;
2131                                    }
2132                            }
2133                            return null;
2134                    }
2135            }
2136            
2137            /**
2138             *Takes audio data that comes from the sound argument and mixes it into playback or notification device, depending on the value passed in the useCallOutDevice argument. The sound argument contains the audio data in in follwing format: first 4 bytes of the binary contain the sample rate, followed by 16 bit (mono) samples. The soundid argument is an arbitrary ID that you can pass in and then later use as an argument for Skype class PlayStop method. To mix the audio into playback device stream, set useCallOutDevice to true, to mic it into notification stream, set useCallOutDevice to false. <br>
2139             * @param soundid
2140             * @param sound
2141             * @param loop
2142             * @param useCallOutDevice
2143             */
2144            public void PlayStart( int soundid, byte[] sound, boolean loop, boolean useCallOutDevice) {
2145            
2146                    Request request = null;
2147                    try {
2148                            request = new XCallRequest(0,48);
2149                    } catch (IOException e) {
2150                            e.printStackTrace();
2151                            if (errorListener != null)
2152                                    errorListener.OnSkypeKitFatalError();
2153                    }
2154                    request.addParm('u',1,soundid);
2155                    request.addParm('B',2,sound);
2156                    request.addParm('b',3,loop);
2157                    request.addParm('b',4,useCallOutDevice);
2158                    
2159                    XCall((XCallRequest)request);
2160            }
2161            
2162            /**
2163             * @param soundid
2164             * @param datafile
2165             * @param loop
2166             * @param useCallOutDevice
2167             * @return result
2168             */
2169            public PREPARESOUNDRESULT PlayStartFromFile( int soundid, String datafile, boolean loop, boolean useCallOutDevice) {
2170            
2171                    Request request = null;
2172                    try {
2173                            request = new XCallRequest(0,212);
2174                    } catch (IOException e) {
2175                            e.printStackTrace();
2176                            if (errorListener != null)
2177                                    errorListener.OnSkypeKitFatalError();
2178                    }
2179                    request.addParm('u',1,soundid);
2180                    request.addParm('f',2,datafile);
2181                    request.addParm('b',3,loop);
2182                    request.addParm('b',4,useCallOutDevice);
2183                    
2184                    Response r = XCall((XCallRequest)request);
2185                    
2186                    if (r.isErrCall())
2187                            return null;
2188                            
2189                    PREPARESOUNDRESULT preparesoundresult = null;
2190                    preparesoundresult = PREPARESOUNDRESULT.get(r.GetAsInt(1));
2191                    return preparesoundresult;
2192            }
2193            
2194            /**
2195             *Stops playback of the soundfile. The argument is the same ID you passed in the Skype class StartPlayback method. <br>
2196             * @param soundid
2197             */
2198            public void PlayStop( int soundid) {
2199            
2200                    Request request = null;
2201                    try {
2202                            request = new XCallRequest(0,49);
2203                    } catch (IOException e) {
2204                            e.printStackTrace();
2205                            if (errorListener != null)
2206                                    errorListener.OnSkypeKitFatalError();
2207                    }
2208                    request.addParm('u',1,soundid);
2209                    
2210                    XCall((XCallRequest)request);
2211            }
2212            
2213            /**
2214             * @param recordAndPlaybackData
2215             */
2216            public void StartRecordingTest( boolean recordAndPlaybackData) {
2217            
2218                    Request request = null;
2219                    try {
2220                            request = new XCallRequest(0,50);
2221                    } catch (IOException e) {
2222                            e.printStackTrace();
2223                            if (errorListener != null)
2224                                    errorListener.OnSkypeKitFatalError();
2225                    }
2226                    request.addParm('b',1,recordAndPlaybackData);
2227                    
2228                    XCall((XCallRequest)request);
2229            }
2230            
2231            /**
2232             */
2233            public void StopRecordingTest() {
2234            
2235                    Request request = null;
2236                    try {
2237                            request = new XCallRequest(0,51);
2238                    } catch (IOException e) {
2239                            e.printStackTrace();
2240                            if (errorListener != null)
2241                                    errorListener.OnSkypeKitFatalError();
2242                    }
2243                    
2244                    XCall((XCallRequest)request);
2245            }
2246            
2247            /**
2248             *This method returns a table in form of three string lists of equal lengths. The first list contains audio output device handles ('hw:0,0', 'hw:0,1', etc.) The second list contains descriptive names of those devices (Ensoniq AudioPCI etc.) The third list contains device product IDs. Note that the values in these lists depend on which audio engine you are running (SAL, PCM, RTP). <br>
2249             * @return GetAvailableOutputDevicesResult
2250             */
2251            public GetAvailableOutputDevicesResult GetAvailableOutputDevices() {
2252            
2253                    Request request = null;
2254                    try {
2255                            request = new XCallRequest(0,53);
2256                    } catch (IOException e) {
2257                            e.printStackTrace();
2258                            if (errorListener != null)
2259                                    errorListener.OnSkypeKitFatalError();
2260                    }
2261                    
2262                    Response r = XCall((XCallRequest)request);
2263                    
2264                    if (r.isErrCall())
2265                            return null;
2266                            
2267                    GetAvailableOutputDevicesResult result = new GetAvailableOutputDevicesResult();
2268                    
2269                    Vector<String> handleList = new Vector<String>();
2270                    while (r.HasMore(1))
2271                    {
2272                            String string = null;
2273                            string  = r.GetAsString(1);
2274                            handleList.add(string);
2275                    }
2276                    result.handleList = handleList.toArray(new String[handleList.size()]);
2277                    
2278                    Vector<String> nameList = new Vector<String>();
2279                    while (r.HasMore(2))
2280                    {
2281                            String string = null;
2282                            string  = r.GetAsString(2);
2283                            nameList.add(string);
2284                    }
2285                    result.nameList = nameList.toArray(new String[nameList.size()]);
2286                    
2287                    Vector<String> productIdList = new Vector<String>();
2288                    while (r.HasMore(3))
2289                    {
2290                            String string = null;
2291                            string  = r.GetAsString(3);
2292                            productIdList.add(string);
2293                    }
2294                    result.productIdList = productIdList.toArray(new String[productIdList.size()]);
2295                    
2296                    return result;
2297            }
2298            
2299            public class GetAvailableOutputDevicesResult {
2300                    public String [] handleList;
2301                    public String [] nameList;
2302                    public String [] productIdList;
2303            }
2304            
2305            /**
2306             *This method returns a table in form of three string lists of equal length. The first list contains audio recording device handles ('hw:0,0', 'hw:0,1', etc.) The second list contains descriptive names of those devices (Ensoniq AudioPCI etc.) The third list contains device product IDs. Note that the values in these lists depend on which audio engine you are running (SAL, PCM, RTP). <br>
2307             * @return GetAvailableRecordingDevicesResult
2308             */
2309            public GetAvailableRecordingDevicesResult GetAvailableRecordingDevices() {
2310            
2311                    Request request = null;
2312                    try {
2313                            request = new XCallRequest(0,54);
2314                    } catch (IOException e) {
2315                            e.printStackTrace();
2316                            if (errorListener != null)
2317                                    errorListener.OnSkypeKitFatalError();
2318                    }
2319                    
2320                    Response r = XCall((XCallRequest)request);
2321                    
2322                    if (r.isErrCall())
2323                            return null;
2324                            
2325                    GetAvailableRecordingDevicesResult result = new GetAvailableRecordingDevicesResult();
2326                    
2327                    Vector<String> handleList = new Vector<String>();
2328                    while (r.HasMore(1))
2329                    {
2330                            String string = null;
2331                            string  = r.GetAsString(1);
2332                            handleList.add(string);
2333                    }
2334                    result.handleList = handleList.toArray(new String[handleList.size()]);
2335                    
2336                    Vector<String> nameList = new Vector<String>();
2337                    while (r.HasMore(2))
2338                    {
2339                            String string = null;
2340                            string  = r.GetAsString(2);
2341                            nameList.add(string);
2342                    }
2343                    result.nameList = nameList.toArray(new String[nameList.size()]);
2344                    
2345                    Vector<String> productIdList = new Vector<String>();
2346                    while (r.HasMore(3))
2347                    {
2348                            String string = null;
2349                            string  = r.GetAsString(3);
2350                            productIdList.add(string);
2351                    }
2352                    result.productIdList = productIdList.toArray(new String[productIdList.size()]);
2353                    
2354                    return result;
2355            }
2356            
2357            public class GetAvailableRecordingDevicesResult {
2358                    public String [] handleList;
2359                    public String [] nameList;
2360                    public String [] productIdList;
2361            }
2362            
2363            /**
2364             *Sets audio devices given in arguments as active audio devices. This command selects all three devices - microphone, playback and the notification channel. Valid input values for this method come from the first string list you get back from Skype class GetAvailableOutputDevices (handleList). <br>
2365             * @param callInDevice
2366             * @param callOutDevice
2367             * @param waveOutDevice
2368             */
2369            public void SelectSoundDevices( String callInDevice, String callOutDevice, String waveOutDevice) {
2370            
2371                    Request request = null;
2372                    try {
2373                            request = new XCallRequest(0,55);
2374                    } catch (IOException e) {
2375                            e.printStackTrace();
2376                            if (errorListener != null)
2377                                    errorListener.OnSkypeKitFatalError();
2378                    }
2379                    request.addParm('S',1,callInDevice);
2380                    request.addParm('S',2,callOutDevice);
2381                    request.addParm('S',3,waveOutDevice);
2382                    
2383                    XCall((XCallRequest)request);
2384            }
2385            
2386            /**
2387             *The uint argument returns AUDIODEVICE_CAPABILITIES (declared in Skype class) <br>
2388             * @param deviceHandle
2389             * @return GetAudioDeviceCapabilitiesResult
2390             */
2391            public GetAudioDeviceCapabilitiesResult GetAudioDeviceCapabilities( String deviceHandle) {
2392            
2393                    Request request = null;
2394                    try {
2395                            request = new XCallRequest(0,56);
2396                    } catch (IOException e) {
2397                            e.printStackTrace();
2398                            if (errorListener != null)
2399                                    errorListener.OnSkypeKitFatalError();
2400                    }
2401                    request.addParm('S',1,deviceHandle);
2402                    
2403                    Response r = XCall((XCallRequest)request);
2404                    
2405                    if (r.isErrCall())
2406                            return null;
2407                            
2408                    GetAudioDeviceCapabilitiesResult result = new GetAudioDeviceCapabilitiesResult();
2409                    
2410                    String interfaceString = null;
2411                    interfaceString = r.GetAsString(1);
2412                    result.interfaceString = interfaceString;
2413                    
2414                    int capabilities = 0;
2415                    capabilities = r.GetAsInt(2);
2416                    result.capabilities = capabilities;
2417                    
2418                    return result;
2419            }
2420            
2421            public class GetAudioDeviceCapabilitiesResult {
2422                    public String interfaceString;
2423                    public int capabilities; /** bit set of AUDIODEVICE_CAPABILITIES */
2424            }
2425            
2426            /**
2427             *Returns current audio stream volume for both playback and microphone streams. Useful for displaying visual audio indicators in you UI. See also Skype class OnNrgLevelsChange callback that gets fired each time the these values are changed. <br>
2428             * @return GetNrgLevelsResult
2429             */
2430            public GetNrgLevelsResult GetNrgLevels() {
2431            
2432                    Request request = null;
2433                    try {
2434                            request = new XCallRequest(0,57);
2435                    } catch (IOException e) {
2436                            e.printStackTrace();
2437                            if (errorListener != null)
2438                                    errorListener.OnSkypeKitFatalError();
2439                    }
2440                    
2441                    Response r = XCall((XCallRequest)request);
2442                    
2443                    if (r.isErrCall())
2444                            return null;
2445                            
2446                    GetNrgLevelsResult result = new GetNrgLevelsResult();
2447                    
2448                    int micLevel = 0;
2449                    micLevel = r.GetAsInt(1);
2450                    result.micLevel = micLevel;
2451                    
2452                    int speakerLevel = 0;
2453                    speakerLevel = r.GetAsInt(2);
2454                    result.speakerLevel = speakerLevel;
2455                    
2456                    return result;
2457            }
2458            
2459            public class GetNrgLevelsResult {
2460                    public int micLevel;
2461                    public int speakerLevel;
2462            }
2463            
2464            /**
2465             *NB! This command only works if its implemented in external audiohost (RTP or PCM host). The command can be is used for passing custom commands from client UI to the audio implementation. <br>
2466             * @param command
2467             * @return response
2468             */
2469            public String VoiceCommand( String command) {
2470            
2471                    Request request = null;
2472                    try {
2473                            request = new XCallRequest(0,58);
2474                    } catch (IOException e) {
2475                            e.printStackTrace();
2476                            if (errorListener != null)
2477                                    errorListener.OnSkypeKitFatalError();
2478                    }
2479                    request.addParm('S',1,command);
2480                    
2481                    Response r = XCall((XCallRequest)request);
2482                    
2483                    if (r.isErrCall())
2484                            return null;
2485                            
2486                    String response = null;
2487                    response = r.GetAsString(1);
2488                    return response;
2489            }
2490            
2491            /**
2492             *Returns value of audio playback volume setting (0..100). <br>
2493             * @return volume
2494             */
2495            public int GetSpeakerVolume() {
2496            
2497                    Request request = null;
2498                    try {
2499                            request = new XCallRequest(0,60);
2500                    } catch (IOException e) {
2501                            e.printStackTrace();
2502                            if (errorListener != null)
2503                                    errorListener.OnSkypeKitFatalError();
2504                    }
2505                    
2506                    Response r = XCall((XCallRequest)request);
2507                    
2508                    if (r.isErrCall())
2509                            return 0;
2510                            
2511                    int volume = 0;
2512                    volume = r.GetAsInt(1);
2513                    return volume;
2514            }
2515            
2516            /**
2517             *This method is for setting speaker volume. It will set the level for Skype digital gain control. Skype audio library will not control gain of audio device itself. <br>
2518             * @param volume
2519             */
2520            public void SetSpeakerVolume( int volume) {
2521            
2522                    Request request = null;
2523                    try {
2524                            request = new XCallRequest(0,61);
2525                    } catch (IOException e) {
2526                            e.printStackTrace();
2527                            if (errorListener != null)
2528                                    errorListener.OnSkypeKitFatalError();
2529                    }
2530                    request.addParm('u',1,volume);
2531                    
2532                    XCall((XCallRequest)request);
2533            }
2534            
2535            /**
2536             *Returns value of microphone volume setting (0..100). It will return the analog gain of audio device set by Skype AGC. For real-time microphone volume, use GetNrgLevels method or OnNrgLevelsChange callback (both are methods of Skype class). <br>
2537             * @return micVolume
2538             */
2539            public int GetMicVolume() {
2540            
2541                    Request request = null;
2542                    try {
2543                            request = new XCallRequest(0,62);
2544                    } catch (IOException e) {
2545                            e.printStackTrace();
2546                            if (errorListener != null)
2547                                    errorListener.OnSkypeKitFatalError();
2548                    }
2549                    
2550                    Response r = XCall((XCallRequest)request);
2551                    
2552                    if (r.isErrCall())
2553                            return 0;
2554                            
2555                    int micVolume = 0;
2556                    micVolume = r.GetAsInt(1);
2557                    return micVolume;
2558            }
2559            
2560            /**
2561             *This method is for setting the microphone volume level. This does not work when Skype AGC (Automatic Gain Control) is enabled, which it is by default. It is currently impossible to disable AGC, so for now this method is here for purpose of future compatibility. <br>
2562             * @param volume
2563             */
2564            public void SetMicVolume( int volume) {
2565            
2566                    Request request = null;
2567                    try {
2568                            request = new XCallRequest(0,63);
2569                    } catch (IOException e) {
2570                            e.printStackTrace();
2571                            if (errorListener != null)
2572                                    errorListener.OnSkypeKitFatalError();
2573                    }
2574                    request.addParm('u',1,volume);
2575                    
2576                    XCall((XCallRequest)request);
2577            }
2578            
2579            /**
2580             *Returns true in &muted argument if the currently selected playback device is muted. <br>
2581             * @return muted
2582             */
2583            public boolean IsSpeakerMuted() {
2584            
2585                    Request request = null;
2586                    try {
2587                            request = new XCallRequest(0,64);
2588                    } catch (IOException e) {
2589                            e.printStackTrace();
2590                            if (errorListener != null)
2591                                    errorListener.OnSkypeKitFatalError();
2592                    }
2593                    
2594                    Response r = XCall((XCallRequest)request);
2595                    
2596                    if (r.isErrCall())
2597                            return false;
2598                            
2599                    boolean muted = false;
2600                    muted = r.GetAsBoolean(1);
2601                    return muted;
2602            }
2603            
2604            /**
2605             *Returns true in &muted argument if the currently selected microphone is muted. <br>
2606             * @return muted
2607             */
2608            public boolean IsMicrophoneMuted() {
2609            
2610                    Request request = null;
2611                    try {
2612                            request = new XCallRequest(0,65);
2613                    } catch (IOException e) {
2614                            e.printStackTrace();
2615                            if (errorListener != null)
2616                                    errorListener.OnSkypeKitFatalError();
2617                    }
2618                    
2619                    Response r = XCall((XCallRequest)request);
2620                    
2621                    if (r.isErrCall())
2622                            return false;
2623                            
2624                    boolean muted = false;
2625                    muted = r.GetAsBoolean(1);
2626                    return muted;
2627            }
2628            
2629            /**
2630             *Sets currently selected playback device mute status according to argument. <br>
2631             * @param mute
2632             */
2633            public void MuteSpeakers( boolean mute) {
2634            
2635                    Request request = null;
2636                    try {
2637                            request = new XCallRequest(0,66);
2638                    } catch (IOException e) {
2639                            e.printStackTrace();
2640                            if (errorListener != null)
2641                                    errorListener.OnSkypeKitFatalError();
2642                    }
2643                    request.addParm('b',1,mute);
2644                    
2645                    XCall((XCallRequest)request);
2646            }
2647            
2648            /**
2649             *Sets currently selected microphone mute status according to argument. <br>
2650             * @param mute
2651             */
2652            public void MuteMicrophone( boolean mute) {
2653            
2654                    Request request = null;
2655                    try {
2656                            request = new XCallRequest(0,67);
2657                    } catch (IOException e) {
2658                            e.printStackTrace();
2659                            if (errorListener != null)
2660                                    errorListener.OnSkypeKitFatalError();
2661                    }
2662                    request.addParm('b',1,mute);
2663                    
2664                    XCall((XCallRequest)request);
2665            }
2666            
2667            /**
2668             */
2669            public enum OPERATING_MEDIA {
2670            
2671                    /** */
2672                    OM_UNKNOWN(0),
2673                    
2674                    /** */
2675                    OM_FREE(1),
2676                    
2677                    /** */
2678                    OM_FREE_WIRELESS(2),
2679                    
2680                    /** */
2681                    OM_3G(3),
2682                    
2683                    /** */
2684                    OM_4G(4);
2685                    
2686                    private static final Map<Integer,OPERATING_MEDIA> lookup = new HashMap<Integer,OPERATING_MEDIA>();
2687                    
2688                    static {
2689                            for(OPERATING_MEDIA s : EnumSet.allOf(OPERATING_MEDIA.class))
2690                                    lookup.put(s.getId(), s);
2691                    }
2692                    
2693                    private final int id;
2694                    
2695                    private OPERATING_MEDIA(int value) {
2696                            this.id = value;
2697                    }
2698                    
2699                    public int getId() { return id; }
2700                    
2701                    public static OPERATING_MEDIA get(int code) {
2702                            return lookup.get(code);
2703                    }
2704                    
2705                    public static OPERATING_MEDIA fromString(String s) {
2706                            for (OPERATING_MEDIA p : lookup.values()) {
2707                                    if (p.toString() == s) {
2708                                            return p;
2709                                    }
2710                            }
2711                            return null;
2712                    }
2713            }
2714            
2715            /**
2716             * @param media
2717             * @param maxUplinkBps
2718             * @param maxDownlinkBps
2719             */
2720            public void SetOperatingMedia( OPERATING_MEDIA media, int maxUplinkBps, int maxDownlinkBps) {
2721            
2722                    Request request = null;
2723                    try {
2724                            request = new XCallRequest(0,255);
2725                    } catch (IOException e) {
2726                            e.printStackTrace();
2727                            if (errorListener != null)
2728                                    errorListener.OnSkypeKitFatalError();
2729                    }
2730                    request.addParm('e',1,media.getId());
2731                    request.addParm('u',2,maxUplinkBps);
2732                    request.addParm('u',3,maxDownlinkBps);
2733                    
2734                    XCall((XCallRequest)request);
2735            }
2736            
2737            /**
2738             *creates and sends a CONFIRMATION_CODE_REQUEST message                   this sends a confirmation code to the number provided
2739             * @param type
2740             * @param number
2741             * @return sms
2742             */
2743            public Sms RequestConfirmationCode( Sms.CONFIRM_TYPE type, String number) {
2744            
2745                    Request request = null;
2746                    try {
2747                            request = new XCallRequest(0,29);
2748                    } catch (IOException e) {
2749                            e.printStackTrace();
2750                            if (errorListener != null)
2751                                    errorListener.OnSkypeKitFatalError();
2752                    }
2753                    request.addParm('e',1,type.getId());
2754                    request.addParm('S',2,number);
2755                    
2756                    Response r = XCall((XCallRequest)request);
2757                    
2758                    if (r.isErrCall())
2759                            return null;
2760                            
2761                    int oid = 0;
2762                    Sms sms = null;
2763                    oid = r.GetOid(1);
2764                    if (oid != AbstractDecoder.NULL_VALUE) {
2765                            sms = (Sms)skype.factory(Sms.moduleID(), oid, skype);
2766                    }
2767                    return sms;
2768            }
2769            
2770            /**
2771             *creates and sends a CONFIRMATION_CODE_SUBMIT message                   this authorizes the number with the server for the purpose given in RequestConfirmationCode
2772             * @param number
2773             * @param code
2774             * @return sms
2775             */
2776            public Sms SubmitConfirmationCode( String number, String code) {
2777            
2778                    Request request = null;
2779                    try {
2780                            request = new XCallRequest(0,30);
2781                    } catch (IOException e) {
2782                            e.printStackTrace();
2783                            if (errorListener != null)
2784                                    errorListener.OnSkypeKitFatalError();
2785                    }
2786                    request.addParm('S',1,number);
2787                    request.addParm('S',2,code);
2788                    
2789                    Response r = XCall((XCallRequest)request);
2790                    
2791                    if (r.isErrCall())
2792                            return null;
2793                            
2794                    int oid = 0;
2795                    Sms sms = null;
2796                    oid = r.GetOid(1);
2797                    if (oid != AbstractDecoder.NULL_VALUE) {
2798                            sms = (Sms)skype.factory(Sms.moduleID(), oid, skype);
2799                    }
2800                    return sms;
2801            }
2802            
2803            /**
2804             *creates an OUTGOING/COMPOSING SMS message
2805             * @return sms
2806             */
2807            public Sms CreateOutgoingSms() {
2808            
2809                    Request request = null;
2810                    try {
2811                            request = new XCallRequest(0,70);
2812                    } catch (IOException e) {
2813                            e.printStackTrace();
2814                            if (errorListener != null)
2815                                    errorListener.OnSkypeKitFatalError();
2816                    }
2817                    
2818                    Response r = XCall((XCallRequest)request);
2819                    
2820                    if (r.isErrCall())
2821                            return null;
2822                            
2823                    int oid = 0;
2824                    Sms sms = null;
2825                    oid = r.GetOid(1);
2826                    if (oid != AbstractDecoder.NULL_VALUE) {
2827                            sms = (Sms)skype.factory(Sms.moduleID(), oid, skype);
2828                    }
2829                    return sms;
2830            }
2831            
2832            /** Setupkey SETUPKEY_FT_AUTOACCEPT type:int  <br>Controls file transfer auto-accept.  <br> - 0 - off <br> - 1 - on <br>This is account-specific setup key. It can only be used while an account is logged in. <br> */
2833            public static final String FT_AUTOACCEPT = "Lib/FileTransfer/AutoAccept";
2834            
2835            /** Setupkey SETUPKEY_FT_SAVEPATH type:string  <br>Full local path to save incoming file transfers (used for AutoAccept feature) <br>This is account-specific setup key. It can only be used while an account is logged in. <br> */
2836            public static final String FT_SAVEPATH = "Lib/FileTransfer/SavePath";
2837            
2838            /** Setupkey SETUPKEY_FT_INCOMING_LIMIT type:uint  <br>Number of simultaneous incoming file transfers (per user). Value 0 means no limitation.  <br>This is account-specific setup key. It can only be used while an account is logged in. <br> */
2839            public static final String FT_INCOMING_LIMIT = "Lib/FileTransfer/IncomingLimit";
2840            
2841            /** Setupkey SETUPKEY_IDLE_TIME_FOR_AWAY type:int  <br>Number of seconds since the last keyboard or mouse activity, after which the online status of currently logged in account should be set to AWAY. See Account.SetAvailability method for more information. <br>This is account-specific setup key. It can only be used while an account is logged in. <br> */
2842            public static final String IDLE_TIME_FOR_AWAY = "Lib/Account/IdleTimeForAway";
2843            
2844            /** Setupkey SETUPKEY_IDLE_TIME_FOR_NA type:int  <br>The Contact.AVAILABILITY.NOT_AVAILABLE online status has been deprecated. This setup key is no longer in use. <br> */
2845            public static final String IDLE_TIME_FOR_NA = "Lib/Account/IdleTimeForNA";
2846            
2847            /**
2848             *Retrieves an Account object by Skype name (identity). This should normally be one of the first method calls after Skype object initialization. Nearly all the other methods require successful account login in order to work properly. The list of accounts that have been used on the local machine/database can be retrieved with Skype.GetExistingAccounts method. If a matching identity is not found, a new Account object is created. This object can then be used to populate requred fields and then use Account.Register method for new account creation. This method returns false on error. <br>
2849             * @param identity Account skypename. <br>
2850             * @return account Returns account object if successful. <br>
2851             */
2852            public Account GetAccount( String identity) {
2853            
2854                    Request request = null;
2855                    try {
2856                            request = new XCallRequest(0,115);
2857                    } catch (IOException e) {
2858                            e.printStackTrace();
2859                            if (errorListener != null)
2860                                    errorListener.OnSkypeKitFatalError();
2861                    }
2862                    request.addParm('S',1,identity);
2863                    
2864                    Response r = XCall((XCallRequest)request);
2865                    
2866                    if (r.isErrCall())
2867                            return null;
2868                            
2869                    int oid = 0;
2870                    Account account = null;
2871                    oid = r.GetOid(1);
2872                    if (oid != AbstractDecoder.NULL_VALUE) {
2873                            if (! object_list.containsKey(oid)) {
2874                                    object_list.clear(); // #AABIP-7: Clear any other account's cached info from previous logins
2875                            }
2876                            account = (Account)skype.factory(Account.moduleID(), oid, skype);
2877                    }
2878                    return account;
2879            }
2880            
2881            /**
2882             *Returns a list of possible profiles used before on this machine
2883             * @return accountNameList
2884             */
2885            public String [] GetExistingAccounts() {
2886            
2887                    Request request = null;
2888                    try {
2889                            request = new XCallRequest(0,113);
2890                    } catch (IOException e) {
2891                            e.printStackTrace();
2892                            if (errorListener != null)
2893                                    errorListener.OnSkypeKitFatalError();
2894                    }
2895                    
2896                    Response r = XCall((XCallRequest)request);
2897                    
2898                    if (r.isErrCall())
2899                            return null;
2900                            
2901                    Vector<String> accountNameList = new Vector<String>();
2902                    while (r.HasMore(1))
2903                    {
2904                            String string = null;
2905                            string  = r.GetAsString(1);
2906                            accountNameList.add(string);
2907                    }
2908                    return accountNameList.toArray(new String[accountNameList.size()]);
2909                    
2910            }
2911            
2912            /**
2913             *return most recently used account that has pwd saved. empty string if none
2914             * @return account
2915             */
2916            public String GetDefaultAccountName() {
2917            
2918                    Request request = null;
2919                    try {
2920                            request = new XCallRequest(0,114);
2921                    } catch (IOException e) {
2922                            e.printStackTrace();
2923                            if (errorListener != null)
2924                                    errorListener.OnSkypeKitFatalError();
2925                    }
2926                    
2927                    Response r = XCall((XCallRequest)request);
2928                    
2929                    if (r.isErrCall())
2930                            return null;
2931                            
2932                    String account = null;
2933                    account = r.GetAsString(1);
2934                    return account;
2935            }
2936            
2937            /**
2938             *suggest a nice skypename to go with given fullname
2939             * @param fullname
2940             * @return suggestedName
2941             */
2942            public String GetSuggestedSkypename( String fullname) {
2943            
2944                    Request request = null;
2945                    try {
2946                            request = new XCallRequest(0,116);
2947                    } catch (IOException e) {
2948                            e.printStackTrace();
2949                            if (errorListener != null)
2950                                    errorListener.OnSkypeKitFatalError();
2951                    }
2952                    request.addParm('S',1,fullname);
2953                    
2954                    Response r = XCall((XCallRequest)request);
2955                    
2956                    if (r.isErrCall())
2957                            return null;
2958                            
2959                    String suggestedName = null;
2960                    suggestedName = r.GetAsString(1);
2961                    return suggestedName;
2962            }
2963            
2964            /**
2965            A value of this type can be returned by one of the following methods (of Skype class): ValidateAvatar, ValidateProfileString, ValidatePassword.  <br> */
2966            public enum VALIDATERESULT {
2967            
2968                    /** Given property could not be validated. The length of the field was within limits and the value is assumed to be Ok. Your client should treat this value as equivalent to VALIDATED_OK. <br>*/
2969                    NOT_VALIDATED(0),
2970                    
2971                    /** Avatar or profile string validation succeeded. <br>*/
2972                    VALIDATED_OK(1),
2973                    
2974                    /** Password is too short. <br>*/
2975                    TOO_SHORT(2),
2976                    
2977                    /** The value exceeds max size limit for the given property. <br>*/
2978                    TOO_LONG(3),
2979                    
2980                    /** Value contains illegal characters. <br>*/
2981                    CONTAINS_INVALID_CHAR(4),
2982                    
2983                    /** Value contains whitespace. <br>*/
2984                    CONTAINS_SPACE(5),
2985                    
2986                    /** Password cannot be the same as skypename. <br>*/
2987                    SAME_AS_USERNAME(6),
2988                    
2989                    /** Value has invalid format. <br>*/
2990                    INVALID_FORMAT(7),
2991                    
2992                    /** Value contains invalid word. <br>*/
2993                    CONTAINS_INVALID_WORD(8),
2994                    
2995                    /** Password is too simple. <br>*/
2996                    TOO_SIMPLE(9),
2997                    
2998                    /** Value starts with an invalid character. <br>*/
2999                    STARTS_WITH_INVALID_CHAR(10);
3000                    
3001                    private static final Map<Integer,VALIDATERESULT> lookup = new HashMap<Integer,VALIDATERESULT>();
3002                    
3003                    static {
3004                            for(VALIDATERESULT s : EnumSet.allOf(VALIDATERESULT.class))
3005                                    lookup.put(s.getId(), s);
3006                    }
3007                    
3008                    private final int id;
3009                    
3010                    private VALIDATERESULT(int value) {
3011                            this.id = value;
3012                    }
3013                    
3014                    public int getId() { return id; }
3015                    
3016                    public static VALIDATERESULT get(int code) {
3017                            return lookup.get(code);
3018                    }
3019                    
3020                    public static VALIDATERESULT fromString(String s) {
3021                            for (VALIDATERESULT p : lookup.values()) {
3022                                    if (p.toString() == s) {
3023                                            return p;
3024                                    }
3025                            }
3026                            return null;
3027                    }
3028            }
3029            
3030            /**
3031             * @param value
3032             * @return ValidateAvatarResult
3033             */
3034            public ValidateAvatarResult ValidateAvatar( byte[] value) {
3035            
3036                    Request request = null;
3037                    try {
3038                            request = new XCallRequest(0,119);
3039                    } catch (IOException e) {
3040                            e.printStackTrace();
3041                            if (errorListener != null)
3042                                    errorListener.OnSkypeKitFatalError();
3043                    }
3044                    request.addParm('B',1,value);
3045                    
3046                    Response r = XCall((XCallRequest)request);
3047                    
3048                    if (r.isErrCall())
3049                            return null;
3050                            
3051                    ValidateAvatarResult result = new ValidateAvatarResult();
3052                    
3053                    VALIDATERESULT validateresult = null;
3054                    validateresult = VALIDATERESULT.get(r.GetAsInt(1));
3055                    result.result = validateresult;
3056                    
3057                    int freeBytesLeft = 0;
3058                    freeBytesLeft = r.GetAsInt(2);
3059                    result.freeBytesLeft = freeBytesLeft;
3060                    
3061                    return result;
3062            }
3063            
3064            public class ValidateAvatarResult {
3065                    public VALIDATERESULT result;
3066                    public int freeBytesLeft;
3067            }
3068            
3069            /**
3070             *This method should be used for validating skypenames before registering new accounts, if the propKey is set to SKYPENAME (Contact class) and forRegistration argument is set to true. If the forRegistration argument is false, only string length check is applied. It is also useful to probe, what the size limits are, for each string property (e.g. 300 characters for moodmessage) <br>
3071             * @param propKey
3072             * @param strValue
3073             * @param forRegistration
3074             * @return ValidateProfileStringResult
3075             */
3076            public ValidateProfileStringResult ValidateProfileString( int propKey, String strValue, boolean forRegistration) {
3077            
3078                    Request request = null;
3079                    try {
3080                            request = new XCallRequest(0,102);
3081                    } catch (IOException e) {
3082                            e.printStackTrace();
3083                            if (errorListener != null)
3084                                    errorListener.OnSkypeKitFatalError();
3085                    }
3086                    request.addParm('e',1,propKey);
3087                    request.addParm('S',2,strValue);
3088                    request.addParm('b',3,forRegistration);
3089                    
3090                    Response r = XCall((XCallRequest)request);
3091                    
3092                    if (r.isErrCall())
3093                            return null;
3094                            
3095                    ValidateProfileStringResult result = new ValidateProfileStringResult();
3096                    
3097                    VALIDATERESULT validateresult = null;
3098                    validateresult = VALIDATERESULT.get(r.GetAsInt(1));
3099                    result.result = validateresult;
3100                    
3101                    int freeBytesLeft = 0;
3102                    freeBytesLeft = r.GetAsInt(2);
3103                    result.freeBytesLeft = freeBytesLeft;
3104                    
3105                    return result;
3106            }
3107            
3108            public class ValidateProfileStringResult {
3109                    public VALIDATERESULT result;
3110                    public int freeBytesLeft;
3111            }
3112            
3113            /**
3114             *This method is for pre-validating account passwords before account creation or password change. The result will return either VALIDATED_OK or one of many possible reasons the password is unacceptable (too short, too simple, etc.) <br>
3115             * @param username
3116             * @param password
3117             * @return result
3118             */
3119            public VALIDATERESULT ValidatePassword( String username, String password) {
3120            
3121                    Request request = null;
3122                    try {
3123                            request = new XCallRequest(0,71);
3124                    } catch (IOException e) {
3125                            e.printStackTrace();
3126                            if (errorListener != null)
3127                                    errorListener.OnSkypeKitFatalError();
3128                    }
3129                    request.addParm('S',1,username);
3130                    request.addParm('S',2,password);
3131                    
3132                    Response r = XCall((XCallRequest)request);
3133                    
3134                    if (r.isErrCall())
3135                            return null;
3136                            
3137                    VALIDATERESULT validateresult = null;
3138                    validateresult = VALIDATERESULT.get(r.GetAsInt(1));
3139                    return validateresult;
3140            }
3141            
3142            /** Setupkey SETUPKEY_PORT type:int  <br>Suggested port number (lib will *try* to use that) <br>This setup key is machine-specific and affects all local accounts. <br> */
3143            public static final String PORT = "*Lib/Connection/Port";
3144            
3145            /** Setupkey SETUPKEY_HTTPS_PROXY_ENABLE type:int  <br>Set to 0 for automatic proxy detect, 1 to use proxy config below <br>This setup key is machine-specific and affects all local accounts. <br> */
3146            public static final String HTTPS_PROXY_ENABLE = "*Lib/Connection/HttpsProxy/Enable";
3147            
3148            /** Setupkey SETUPKEY_HTTPS_PROXY_ADDR type:string  <br>name:port of HTTP proxy server <br>This setup key is machine-specific and affects all local accounts. <br> */
3149            public static final String HTTPS_PROXY_ADDR = "*Lib/Connection/HttpsProxy/Addr";
3150            
3151            /** Setupkey SETUPKEY_HTTPS_PROXY_USER type:string  <br>HTTPS proxy server username <br>This setup key is machine-specific and affects all local accounts. <br> */
3152            public static final String HTTPS_PROXY_USER = "*Lib/Connection/HttpsProxy/User";
3153            
3154            /** Setupkey SETUPKEY_HTTPS_PROXY_PWD type:string  <br>HTTPS proxy server password (base64 encoded) <br>This setup key is machine-specific and affects all local accounts. <br> */
3155            public static final String HTTPS_PROXY_PWD = "*Lib/Connection/HttpsProxy/Pwd";
3156            
3157            /** Setupkey SETUPKEY_SOCKS_PROXY_ENABLE type:int  <br>Set to non-zero to enable socks proxy support <br>This setup key is machine-specific and affects all local accounts. <br> */
3158            public static final String SOCKS_PROXY_ENABLE = "*Lib/Connection/SocksProxy/Enable";
3159            
3160            /** Setupkey SETUPKEY_SOCKS_PROXY_ADDR type:string  <br>name:port of SOCKS proxy server <br>This setup key is machine-specific and affects all local accounts. <br> */
3161            public static final String SOCKS_PROXY_ADDR = "*Lib/Connection/SocksProxy/Addr";
3162            
3163            /** Setupkey SETUPKEY_SOCKS_PROXY_USER type:string  <br>SOCKS proxy server username <br>This setup key is machine-specific and affects all local accounts. <br> */
3164            public static final String SOCKS_PROXY_USER = "*Lib/Connection/SocksProxy/User";
3165            
3166            /** Setupkey SETUPKEY_SOCKS_PROXY_PWD type:string  <br>SOCKS proxy server password (base64 encoded) <br>This setup key is machine-specific and affects all local accounts. <br> */
3167            public static final String SOCKS_PROXY_PWD = "*Lib/Connection/SocksProxy/Pwd";
3168            
3169            /** Setupkey SETUPKEY_LOCALADDRESS type:string  <br>local interface to listen to <br>This setup key is machine-specific and affects all local accounts. <br> */
3170            public static final String LOCALADDRESS = "*Lib/Connection/LocalAddress";
3171            
3172            /** Setupkey SETUPKEY_DISABLE_PORT80 type:int  <br>1 disables listening of alternative ports (80, 443) <br>This setup key is machine-specific and affects all local accounts. <br> */
3173            public static final String DISABLE_PORT80 = "*Lib/Connection/DisablePort80";
3174            
3175            /** Setupkey SETUPKEY_DISABLE_UDP type:int  <br>1 disables UDP port binding. should be set before connect <br>This setup key is machine-specific and affects all local accounts. <br> */
3176            public static final String DISABLE_UDP = "*Lib/Connection/DisableUDP";
3177            
3178            /**
3179             */
3180            public enum PROXYTYPE {
3181            
3182                    /** */
3183                    HTTPS_PROXY(0),
3184                    
3185                    /** */
3186                    SOCKS_PROXY(1);
3187                    
3188                    private static final Map<Integer,PROXYTYPE> lookup = new HashMap<Integer,PROXYTYPE>();
3189                    
3190                    static {
3191                            for(PROXYTYPE s : EnumSet.allOf(PROXYTYPE.class))
3192                                    lookup.put(s.getId(), s);
3193                    }
3194                    
3195                    private final int id;
3196                    
3197                    private PROXYTYPE(int value) {
3198                            this.id = value;
3199                    }
3200                    
3201                    public int getId() { return id; }
3202                    
3203                    public static PROXYTYPE get(int code) {
3204                            return lookup.get(code);
3205                    }
3206                    
3207                    public static PROXYTYPE fromString(String s) {
3208                            for (PROXYTYPE p : lookup.values()) {
3209                                    if (p.toString() == s) {
3210                                            return p;
3211                                    }
3212                            }
3213                            return null;
3214                    }
3215            }
3216            
3217            /**
3218             *port that lib ended up listening. usually equal to SETUPKEY_PORT. 0 if none used (disconnected or binding failed)
3219             * @return port
3220             */
3221            public int GetUsedPort() {
3222            
3223                    Request request = null;
3224                    try {
3225                            request = new XCallRequest(0,130);
3226                    } catch (IOException e) {
3227                            e.printStackTrace();
3228                            if (errorListener != null)
3229                                    errorListener.OnSkypeKitFatalError();
3230                    }
3231                    
3232                    Response r = XCall((XCallRequest)request);
3233                    
3234                    if (r.isErrCall())
3235                            return 0;
3236                            
3237                    int port = 0;
3238                    port = r.GetAsInt(1);
3239                    return port;
3240            }
3241            
3242            /**
3243             *This is used for retrieving local setup keys of type string. For more information, see Defines section in the skype-embedded_2.h  <br>
3244             * @param key
3245             * @return value
3246             */
3247            public String GetStr( String key) {
3248            
3249                    Request request = null;
3250                    try {
3251                            request = new XCallRequest(0,120);
3252                    } catch (IOException e) {
3253                            e.printStackTrace();
3254                            if (errorListener != null)
3255                                    errorListener.OnSkypeKitFatalError();
3256                    }
3257                    request.addParm('S',1,key);
3258                    
3259                    Response r = XCall((XCallRequest)request);
3260                    
3261                    if (r.isErrCall())
3262                            return null;
3263                            
3264                    String value = null;
3265                    value = r.GetAsString(1);
3266                    return value;
3267            }
3268            
3269            /**
3270             *This is used for retrieving local setup keys of type int. For more information, see Defines section in the skype-embedded_2.h  <br>
3271             * @param key
3272             * @return value
3273             */
3274            public int GetInt( String key) {
3275            
3276                    Request request = null;
3277                    try {
3278                            request = new XCallRequest(0,121);
3279                    } catch (IOException e) {
3280                            e.printStackTrace();
3281                            if (errorListener != null)
3282                                    errorListener.OnSkypeKitFatalError();
3283                    }
3284                    request.addParm('S',1,key);
3285                    
3286                    Response r = XCall((XCallRequest)request);
3287                    
3288                    if (r.isErrCall())
3289                            return 0;
3290                            
3291                    int value = 0;
3292                    value = r.GetAsInt(1);
3293                    return value;
3294            }
3295            
3296            /**
3297             *This is used for retrieving local setup keys of type binary. For more information, see Defines section in the skype-embedded_2.h  <br>
3298             * @param key
3299             * @return value
3300             */
3301            public byte[] GetBin( String key) {
3302            
3303                    Request request = null;
3304                    try {
3305                            request = new XCallRequest(0,122);
3306                    } catch (IOException e) {
3307                            e.printStackTrace();
3308                            if (errorListener != null)
3309                                    errorListener.OnSkypeKitFatalError();
3310                    }
3311                    request.addParm('S',1,key);
3312                    
3313                    Response r = XCall((XCallRequest)request);
3314                    
3315                    if (r.isErrCall())
3316                            return null;
3317                            
3318                    byte[] value = null;
3319                    value = r.GetAsBinary(1);
3320                    return value;
3321            }
3322            
3323            /**
3324             *This is used for setting local setup keys of type string. For more information, see Defines section in the skype-embedded_2.h  <br>
3325             * @param key
3326             * @param value
3327             */
3328            public void SetStr( String key, String value) {
3329            
3330                    Request request = null;
3331                    try {
3332                            request = new XCallRequest(0,123);
3333                    } catch (IOException e) {
3334                            e.printStackTrace();
3335                            if (errorListener != null)
3336                                    errorListener.OnSkypeKitFatalError();
3337                    }
3338                    request.addParm('S',1,key);
3339                    request.addParm('S',2,value);
3340                    
3341                    XCall((XCallRequest)request);
3342            }
3343            
3344            /**
3345             *This is used for setting local setup keys of type int. For more information, see Defines section in the skype-embedded_2.h  <br>
3346             * @param key
3347             * @param value
3348             */
3349            public void SetInt( String key, int value) {
3350            
3351                    Request request = null;
3352                    try {
3353                            request = new XCallRequest(0,124);
3354                    } catch (IOException e) {
3355                            e.printStackTrace();
3356                            if (errorListener != null)
3357                                    errorListener.OnSkypeKitFatalError();
3358                    }
3359                    request.addParm('S',1,key);
3360                    request.addParm('i',2,value);
3361                    
3362                    XCall((XCallRequest)request);
3363            }
3364            
3365            /**
3366             *This is used for setting local setup keys of type binary. For more information, see Defines section in the skype-embedded_2.h  <br>
3367             * @param key
3368             * @param value
3369             */
3370            public void SetBin( String key, byte[] value) {
3371            
3372                    Request request = null;
3373                    try {
3374                            request = new XCallRequest(0,125);
3375                    } catch (IOException e) {
3376                            e.printStackTrace();
3377                            if (errorListener != null)
3378                                    errorListener.OnSkypeKitFatalError();
3379                    }
3380                    request.addParm('S',1,key);
3381                    request.addParm('B',2,value);
3382                    
3383                    XCall((XCallRequest)request);
3384            }
3385            
3386            /**
3387             *Returns true if the given setup key is defined in local setup. For more information, see Defines section in the skype-embedded_2.h  <br>
3388             * @param key
3389             * @return value
3390             */
3391            public boolean IsDefined( String key) {
3392            
3393                    Request request = null;
3394                    try {
3395                            request = new XCallRequest(0,126);
3396                    } catch (IOException e) {
3397                            e.printStackTrace();
3398                            if (errorListener != null)
3399                                    errorListener.OnSkypeKitFatalError();
3400                    }
3401                    request.addParm('S',1,key);
3402                    
3403                    Response r = XCall((XCallRequest)request);
3404                    
3405                    if (r.isErrCall())
3406                            return false;
3407                            
3408                    boolean value = false;
3409                    value = r.GetAsBoolean(1);
3410                    return value;
3411            }
3412            
3413            /**
3414             * @param key
3415             */
3416            public void Delete( String key) {
3417            
3418                    Request request = null;
3419                    try {
3420                            request = new XCallRequest(0,127);
3421                    } catch (IOException e) {
3422                            e.printStackTrace();
3423                            if (errorListener != null)
3424                                    errorListener.OnSkypeKitFatalError();
3425                    }
3426                    request.addParm('S',1,key);
3427                    
3428                    XCall((XCallRequest)request);
3429            }
3430            
3431            /**
3432             * @param key
3433             * @return value
3434             */
3435            public String [] GetSubKeys( String key) {
3436            
3437                    Request request = null;
3438                    try {
3439                            request = new XCallRequest(0,128);
3440                    } catch (IOException e) {
3441                            e.printStackTrace();
3442                            if (errorListener != null)
3443                                    errorListener.OnSkypeKitFatalError();
3444                    }
3445                    request.addParm('S',1,key);
3446                    
3447                    Response r = XCall((XCallRequest)request);
3448                    
3449                    if (r.isErrCall())
3450                            return null;
3451                            
3452                    Vector<String> value = new Vector<String>();
3453                    while (r.HasMore(1))
3454                    {
3455                            String string = null;
3456                            string  = r.GetAsString(1);
3457                            value.add(string);
3458                    }
3459                    return value.toArray(new String[value.size()]);
3460                    
3461            }
3462            
3463            /**
3464             *Returns two string lists. First of them will contain list of two-letter language codes (ISO 639-1) The second list contains names of corresponding languages. <br>
3465             * @return GetISOLanguageInfoResult
3466             */
3467            public GetISOLanguageInfoResult GetISOLanguageInfo() {
3468            
3469                    Request request = null;
3470                    try {
3471                            request = new XCallRequest(0,207);
3472                    } catch (IOException e) {
3473                            e.printStackTrace();
3474                            if (errorListener != null)
3475                                    errorListener.OnSkypeKitFatalError();
3476                    }
3477                    
3478                    Response r = XCall((XCallRequest)request);
3479                    
3480                    if (r.isErrCall())
3481                            return null;
3482                            
3483                    GetISOLanguageInfoResult result = new GetISOLanguageInfoResult();
3484                    
3485                    Vector<String> languageCodeList = new Vector<String>();
3486                    while (r.HasMore(1))
3487                    {
3488                            String string = null;
3489                            string  = r.GetAsString(1);
3490                            languageCodeList.add(string);
3491                    }
3492                    result.languageCodeList = languageCodeList.toArray(new String[languageCodeList.size()]);
3493                    
3494                    Vector<String> languageNameList = new Vector<String>();
3495                    while (r.HasMore(2))
3496                    {
3497                            String string = null;
3498                            string  = r.GetAsString(2);
3499                            languageNameList.add(string);
3500                    }
3501                    result.languageNameList = languageNameList.toArray(new String[languageNameList.size()]);
3502                    
3503                    return result;
3504            }
3505            
3506            public class GetISOLanguageInfoResult {
3507                    public String [] languageCodeList;
3508                    public String [] languageNameList; /** assumes UI has set correct language */
3509            }
3510            
3511            /**
3512             *Returns three string lists and one int array, containing 2-letter country code, country name, dialing prefix and example dial string (not available for all items). This method does currently return 0 for South Georgia and the South Sandwich Islands. <br>
3513             * @return GetISOCountryInfoResult
3514             */
3515            public GetISOCountryInfoResult GetISOCountryInfo() {
3516            
3517                    Request request = null;
3518                    try {
3519                            request = new XCallRequest(0,208);
3520                    } catch (IOException e) {
3521                            e.printStackTrace();
3522                            if (errorListener != null)
3523                                    errorListener.OnSkypeKitFatalError();
3524                    }
3525                    
3526                    Response r = XCall((XCallRequest)request);
3527                    
3528                    if (r.isErrCall())
3529                            return null;
3530                            
3531                    GetISOCountryInfoResult result = new GetISOCountryInfoResult();
3532                    
3533                    Vector<String> countryCodeList = new Vector<String>();
3534                    while (r.HasMore(1))
3535                    {
3536                            String string = null;
3537                            string  = r.GetAsString(1);
3538                            countryCodeList.add(string);
3539                    }
3540                    result.countryCodeList = countryCodeList.toArray(new String[countryCodeList.size()]);
3541                    
3542                    Vector<String> countryNameList = new Vector<String>();
3543                    while (r.HasMore(2))
3544                    {
3545                            String string = null;
3546                            string  = r.GetAsString(2);
3547                            countryNameList.add(string);
3548                    }
3549                    result.countryNameList = countryNameList.toArray(new String[countryNameList.size()]);
3550                    
3551                    Vector<Integer> countryPrefixList = new Vector<Integer>();
3552                    while (r.HasMore(3))
3553                    {
3554                            Integer integer = null;
3555                            integer = new Integer(r.GetAsInt(3));
3556                            countryPrefixList.add(integer);
3557                    }
3558                    
3559                    int[] intArray = new int[countryPrefixList.size()];
3560                    for (int i = 0; i < countryPrefixList.size(); i++) {
3561                            intArray[i] = countryPrefixList.get(i);
3562                    }
3563                    result.countryPrefixList = intArray;
3564                    Vector<String> countryDialExampleList = new Vector<String>();
3565                    while (r.HasMore(4))
3566                    {
3567                            String string = null;
3568                            string  = r.GetAsString(4);
3569                            countryDialExampleList.add(string);
3570                    }
3571                    result.countryDialExampleList = countryDialExampleList.toArray(new String[countryDialExampleList.size()]);
3572                    
3573                    return result;
3574            }
3575            
3576            public class GetISOCountryInfoResult {
3577                    public String [] countryCodeList;
3578                    public String [] countryNameList; /** assumes UI has set correct language */
3579                    public int [] countryPrefixList;
3580                    public String [] countryDialExampleList;
3581            }
3582            
3583            /**
3584             *Returns 2-letter country code based on PSTN number. The input argument has to be without + in from of it - '37212345678' will return 'ee' while '+37212345678' will return an empty string. <br>
3585             * @param number
3586             * @return countryCode
3587             */
3588            public String GetISOCountryCodebyPhoneNo( String number) {
3589            
3590                    Request request = null;
3591                    try {
3592                            request = new XCallRequest(0,211);
3593                    } catch (IOException e) {
3594                            e.printStackTrace();
3595                            if (errorListener != null)
3596                                    errorListener.OnSkypeKitFatalError();
3597                    }
3598                    request.addParm('S',1,number);
3599                    
3600                    Response r = XCall((XCallRequest)request);
3601                    
3602                    if (r.isErrCall())
3603                            return null;
3604                            
3605                    String countryCode = null;
3606                    countryCode = r.GetAsString(1);
3607                    return countryCode;
3608            }
3609            
3610            /**
3611             * Format property value, typically as seen in an onPropertyChange()
3612             * listener, as a string.
3613             * 
3614             * @param moid
3615             *            - module ID, from (apiClass).moduleID()
3616             * @param pid
3617             *            - property id, fromm prop.getId()
3618             * @param value
3619             *            - generic property value, as found in onPropertyChange()
3620             *            listner interface
3621             * @return property value formatted as a String
3622             */
3623            public static String getPropertyAsString(int moid, int pid, Object value)
3624            {
3625                    // assuming we do not want to get string properties here, if the value is null, return null
3626                    if (value == null) {
3627                            return null;
3628                    }
3629                    switch (moid) {
3630                    case 10:
3631                            switch (pid) {
3632                                    case 155: return ContactGroup.TYPE.get((Integer)value).toString();
3633                                    case 154: return value.toString();
3634                                    case 151: return value.toString();
3635                                    case 152: return value.toString();
3636                                    case 153: return value.toString();
3637                            }
3638                            break;
3639                    case 2:
3640                            switch (pid) {
3641                                    case 202: return Contact.TYPE.get((Integer)value).toString();
3642                                    case 4: return value.toString();
3643                                    case 6: return value.toString();
3644                                    case 5: return value.toString();
3645                                    case 7: return value.toString();
3646                                    case 8: return value.toString();
3647                                    case 9: return value.toString();
3648                                    case 10: return value.toString();
3649                                    case 11: return value.toString();
3650                                    case 12: return value.toString();
3651                                    case 13: return value.toString();
3652                                    case 14: return value.toString();
3653                                    case 15: return value.toString();
3654                                    case 16: return value.toString();
3655                                    case 17: return value.toString();
3656                                    case 18: return value.toString();
3657                                    case 37: return "<binary>";
3658                                    case 26: return value.toString();
3659                                    case 205: return value.toString();
3660                                    case 27: return value.toString();
3661                                    case 36: return "<binary>";
3662                                    case 19: return value.toString();
3663                                    case 28: return value.toString();
3664                                    case 29: return value.toString();
3665                                    case 182: return value.toString();
3666                                    case 183: return value.toString();
3667                                    case 20: return value.toString();
3668                                    case 25: return value.toString();
3669                                    case 35: return value.toString();
3670                                    case 34: return Contact.AVAILABILITY.get((Integer)value).toString();
3671                                    case 21: return value.toString();
3672                                    case 22: return value.toString();
3673                                    case 23: return Contact.AUTHLEVEL.get((Integer)value).toString();
3674                                    case 33: return value.toString();
3675                                    case 180: return value.toString();
3676                                    case 39: return value.toString();
3677                                    case 41: return value.toString();
3678                                    case 184: return value.toString();
3679                                    case 185: return value.toString();
3680                                    case 186: return value.toString();
3681                                    case 187: return value.toString();
3682                                    case 188: return value.toString();
3683                                    case 189: return value.toString();
3684                                    case 42: return value.toString();
3685                            }
3686                            break;
3687                    case 1:
3688                            switch (pid) {
3689                                    case 200: return ContactSearch.STATUS.get((Integer)value).toString();
3690                            }
3691                            break;
3692                    case 19:
3693                            switch (pid) {
3694                                    case 930: return value.toString();
3695                                    case 931: return value.toString();
3696                                    case 932: return Participant.RANK.get((Integer)value).toString();
3697                                    case 933: return Participant.RANK.get((Integer)value).toString();
3698                                    case 934: return Participant.TEXT_STATUS.get((Integer)value).toString();
3699                                    case 935: return Participant.VOICE_STATUS.get((Integer)value).toString();
3700                                    case 936: return Participant.VIDEO_STATUS.get((Integer)value).toString();
3701                                    case 943: return value.toString();
3702                                    case 938: return value.toString();
3703                                    case 948: return value.toString();
3704                                    case 939: return value.toString();
3705                                    case 941: return value.toString();
3706                                    case 942: return value.toString();
3707                                    case 947: return value.toString();
3708                                    case 949: return value.toString();
3709                                    case 950: return IDENTITYTYPE.get((Integer)value).toString();
3710                                    case 951: return value.toString();
3711                                    case 952: return value.toString();
3712                                    case 953: return value.toString();
3713                                    case 954: return value.toString();
3714                                    case 955: return LEAVE_REASON.get((Integer)value).toString();
3715                            }
3716                            break;
3717                    case 18:
3718                            switch (pid) {
3719                                    case 972: return value.toString();
3720                                    case 902: return Conversation.TYPE.get((Integer)value).toString();
3721                                    case 918: return value.toString();
3722                                    case 974: return value.toString();
3723                                    case 996: return value.toString();
3724                                    case 920: return value.toString();
3725                                    case 921: return value.toString();
3726                                    case 925: return value.toString();
3727                                    case 924: return value.toString();
3728                                    case 927: return Conversation.LOCAL_LIVESTATUS.get((Integer)value).toString();
3729                                    case 928: return value.toString();
3730                                    case 973: return value.toString();
3731                                    case 975: return value.toString();
3732                                    case 976: return value.toString();
3733                                    case 977: return value.toString();
3734                                    case 970: return value.toString();
3735                                    case 971: return value.toString();
3736                                    case 979: return value.toString();
3737                                    case 981: return value.toString();
3738                                    case 915: return value.toString();
3739                                    case 903: return value.toString();
3740                                    case 904: return value.toString();
3741                                    case 919: return Conversation.MY_STATUS.get((Integer)value).toString();
3742                                    case 922: return value.toString();
3743                                    case 906: return Participant.RANK.get((Integer)value).toString();
3744                                    case 907: return value.toString();
3745                                    case 909: return Conversation.ALLOWED_ACTIVITY.get((Integer)value).toString();
3746                                    case 980: return value.toString();
3747                                    case 910: return value.toString();
3748                                    case 911: return value.toString();
3749                                    case 913: return value.toString();
3750                                    case 914: return "<binary>";
3751                            }
3752                            break;
3753                    case 9:
3754                            switch (pid) {
3755                                    case 960: return value.toString();
3756                                    case 120: return value.toString();
3757                                    case 122: return value.toString();
3758                                    case 123: return value.toString();
3759                                    case 792: return "<binary>";
3760                                    case 790: return value.toString();
3761                                    case 121: return value.toString();
3762                                    case 961: return Message.TYPE.get((Integer)value).toString();
3763                                    case 962: return Message.SENDING_STATUS.get((Integer)value).toString();
3764                                    case 968: return Message.CONSUMPTION_STATUS.get((Integer)value).toString();
3765                                    case 222: return value.toString();
3766                                    case 223: return value.toString();
3767                                    case 963: return value.toString();
3768                                    case 964: return value.toString();
3769                                    case 127: return value.toString();
3770                                    case 125: return value.toString();
3771                                    case 966: return value.toString();
3772                                    case 126: return LEAVE_REASON.get((Integer)value).toString();
3773                                    case 982: return value.toString();
3774                            }
3775                            break;
3776                    case 11:
3777                            switch (pid) {
3778                                    case 130: return Video.STATUS.get((Integer)value).toString();
3779                                    case 131: return value.toString();
3780                                    case 132: return value.toString();
3781                                    case 133: return value.toString();
3782                                    case 134: return Video.MEDIATYPE.get((Integer)value).toString();
3783                                    case 1104: return value.toString();
3784                                    case 1105: return value.toString();
3785                            }
3786                            break;
3787                    case 7:
3788                            switch (pid) {
3789                                    case 100: return Voicemail.TYPE.get((Integer)value).toString();
3790                                    case 101: return value.toString();
3791                                    case 102: return value.toString();
3792                                    case 103: return Voicemail.STATUS.get((Integer)value).toString();
3793                                    case 104: return Voicemail.FAILUREREASON.get((Integer)value).toString();
3794                                    case 105: return value.toString();
3795                                    case 106: return value.toString();
3796                                    case 107: return value.toString();
3797                                    case 108: return value.toString();
3798                                    case 109: return value.toString();
3799                                    case 830: return value.toString();
3800                                    case 831: return "<binary>";
3801                            }
3802                            break;
3803                    case 12:
3804                            switch (pid) {
3805                                    case 190: return Sms.TYPE.get((Integer)value).toString();
3806                                    case 191: return Sms.STATUS.get((Integer)value).toString();
3807                                    case 192: return Sms.FAILUREREASON.get((Integer)value).toString();
3808                                    case 48: return value.toString();
3809                                    case 198: return value.toString();
3810                                    case 193: return value.toString();
3811                                    case 49: return value.toString();
3812                                    case 194: return value.toString();
3813                                    case 199: return value.toString();
3814                                    case 195: return value.toString();
3815                                    case 196: return "<binary>";
3816                                    case 197: return value.toString();
3817                                    case 840: return value.toString();
3818                            }
3819                            break;
3820                    case 6:
3821                            switch (pid) {
3822                                    case 80: return Transfer.TYPE.get((Integer)value).toString();
3823                                    case 81: return value.toString();
3824                                    case 82: return value.toString();
3825                                    case 83: return Transfer.STATUS.get((Integer)value).toString();
3826                                    case 84: return Transfer.FAILUREREASON.get((Integer)value).toString();
3827                                    case 85: return value.toString();
3828                                    case 86: return value.toString();
3829                                    case 87: return value.toString();
3830                                    case 88: return value.toString();
3831                                    case 89: return value.toString();
3832                                    case 90: return value.toString();
3833                                    case 91: return value.toString();
3834                                    case 92: return "<binary>";
3835                                    case 93: return value.toString();
3836                                    case 98: return value.toString();
3837                            }
3838                            break;
3839                    case 5:
3840                            switch (pid) {
3841                                    case 70: return Account.STATUS.get((Integer)value).toString();
3842                                    case 71: return Account.PWDCHANGESTATUS.get((Integer)value).toString();
3843                                    case 73: return Account.LOGOUTREASON.get((Integer)value).toString();
3844                                    case 78: return Account.COMMITSTATUS.get((Integer)value).toString();
3845                                    case 72: return value.toString();
3846                                    case 74: return value.toString();
3847                                    case 75: return value.toString();
3848                                    case 804: return value.toString();
3849                                    case 76: return value.toString();
3850                                    case 79: return Account.CBLSYNCSTATUS.get((Integer)value).toString();
3851                                    case 77: return value.toString();
3852                                    case 160: return Account.CHATPOLICY.get((Integer)value).toString();
3853                                    case 161: return Account.SKYPECALLPOLICY.get((Integer)value).toString();
3854                                    case 162: return Account.PSTNCALLPOLICY.get((Integer)value).toString();
3855                                    case 163: return Account.AVATARPOLICY.get((Integer)value).toString();
3856                                    case 164: return Account.BUDDYCOUNTPOLICY.get((Integer)value).toString();
3857                                    case 165: return Account.TIMEZONEPOLICY.get((Integer)value).toString();
3858                                    case 166: return Account.WEBPRESENCEPOLICY.get((Integer)value).toString();
3859                                    case 168: return Account.PHONENUMBERSPOLICY.get((Integer)value).toString();
3860                                    case 169: return Account.VOICEMAILPOLICY.get((Integer)value).toString();
3861                                    case 773: return value.toString();
3862                                    case 800: return value.toString();
3863                                    case 801: return value.toString();
3864                                    case 802: return value.toString();
3865                                    case 4: return value.toString();
3866                                    case 5: return value.toString();
3867                                    case 7: return value.toString();
3868                                    case 8: return value.toString();
3869                                    case 9: return value.toString();
3870                                    case 10: return value.toString();
3871                                    case 11: return value.toString();
3872                                    case 12: return value.toString();
3873                                    case 13: return value.toString();
3874                                    case 14: return value.toString();
3875                                    case 15: return value.toString();
3876                                    case 16: return value.toString();
3877                                    case 17: return value.toString();
3878                                    case 18: return value.toString();
3879                                    case 19: return value.toString();
3880                                    case 26: return value.toString();
3881                                    case 27: return value.toString();
3882                                    case 28: return value.toString();
3883                                    case 34: return Contact.AVAILABILITY.get((Integer)value).toString();
3884                                    case 37: return "<binary>";
3885                                    case 182: return value.toString();
3886                                    case 183: return value.toString();
3887                                    case 205: return value.toString();
3888                            }
3889                            break;
3890                    }
3891                    return null;
3892            }
3893    }