internal override SktObjectList CreateObjectList(uint classId) { SktObjectList newList; switch (classId) { case 19 : newList = new SktParticipant.List(); break; case 10 : newList = new SktContactGroup.List(); break; case 11 : newList = new SktVideo.List(); break; case 9 : newList = new SktMessage.List(); break; case 7 : newList = new SktVoicemail.List(); break; case 6 : newList = new SktTransfer.List(); break; case 2 : newList = new SktContact.List(); break; case 18 : newList = new SktConversation.List(); break; case 1 : newList = new SktContactSearch.List(); break; case 12 : newList = new SktSms.List(); break; case 5 : newList = new SktAccount.List(); break; default: skypeRef.Error(String.Format("Attempt to construct a list object with invalid class ID {0}", classId)); return null; } return newList; }
/** Returns recent messages. The messages are returned in two lists - new messages (unconsumed) and recent message history (context messages). The context message list contains messages that are already above the consumption horizon but are fairly recent, making it likely that displaying them in UI would be good default behaviour. @param [out] contextMessages Already consumed messages, provided for context @param [out] unconsumedMessages Unconsumed messages @param [in] requireTimestamp - If set to a non-zero value, includes messages no earlier than this timestamp, if not, includes messages from the last 24 hours only */ public void GetLastMessages( out SktMessage.List contextMessages, out SktMessage.List unconsumedMessages, DateTime requireTimestamp) { if (skypeRef.logging) skypeRef.Log("Executing Conversation.GetLastMessages"); uint RequestId = skypeRef.encoder.AddMethodHeader(ClassId, 39, OID); skypeRef.encoder.AddTimeStampParam(1, requireTimestamp); contextMessages = new SktMessage.List(); // We always guarantee non-null list is returned unconsumedMessages = new SktMessage.List(); // We always guarantee non-null list is returned skypeRef.transport.SubmitMethodRequest (RequestId); int argNr, marker; do { marker = (char)skypeRef.transport.ReadByte(); if (marker != 'z') { if (marker == 'N') skypeRef.Error("SktConversation.GetLastMessages failed."); argNr = (char)skypeRef.transport.ReadByte(); switch (argNr) { case 1: contextMessages = (SktMessage.List)skypeRef.decoder.DecodeObjectList(9); break; case 2: unconsumedMessages = (SktMessage.List)skypeRef.decoder.DecodeObjectList(9); break; case 'z': marker = argNr; break; // exiting the arg loop if the method failed default: skypeRef.Error(String.Format("Got unexpected response argument {0} from runtime in SktConversation.GetLastMessages", argNr)); break; } } } while (marker != 'z'); skypeRef.transport.ResumeSocketReaderFromMethod(); }
/** Returns all messages of the given type @returns messages @param [in] type - Type of messages requested. For POSTED_TEXT or POSTED_EMOTE, returns a list with both types @param [in] latestPerConvOnly - Whether to return only the most recent message per conversation @param [in] fromTimestampInc - Starting timestamp for reqested range, inclusive @param [in] toTimestampExc - Ending timestamp for requested range, exclusive */ public SktMessage.List GetMessageListByType( SktMessage.TYPE type, Boolean latestPerConvOnly, DateTime fromTimestampInc, DateTime toTimestampExc) { if (skypeRef.logging) skypeRef.Log("Executing Skype.GetMessageListByType"); uint RequestId = skypeRef.encoder.AddMethodHeader(ClassId, 136, OID); skypeRef.encoder.AddEnumParam(1, (uint)type); skypeRef.encoder.AddBoolParam(2, latestPerConvOnly); skypeRef.encoder.AddTimeStampParam(3, fromTimestampInc); skypeRef.encoder.AddTimeStampParam(4, toTimestampExc); SktMessage.List messages = new SktMessage.List(); // We always guarantee non-null list is returned skypeRef.transport.SubmitMethodRequest (RequestId); int argNr, marker; do { marker = (char)skypeRef.transport.ReadByte(); if (marker != 'z') { if (marker == 'N') skypeRef.Error("SktSkype.GetMessageListByType failed."); argNr = (char)skypeRef.transport.ReadByte(); switch (argNr) { case 1: messages = (SktMessage.List)skypeRef.decoder.DecodeObjectList(9); break; case 'z': marker = argNr; break; // exiting the arg loop if the method failed default: skypeRef.Error(String.Format("Got unexpected response argument {0} from runtime in SktSkype.GetMessageListByType", argNr)); break; } } } while (marker != 'z'); skypeRef.transport.ResumeSocketReaderFromMethod(); return messages; }