// Token: 0x06000F5B RID: 3931 RVA: 0x0003B67C File Offset: 0x0003987C public static ConversationType[] GetConversationDataFromSearchFolder(OwaSearchContext searchContext, MailboxSession mailboxSession, out int totalItemCount) { totalItemCount = 0; List <ConversationType> list = new List <ConversationType>(50); StoreId searchFolderId = searchContext.SearchFolderId; SortBy[] searchSortBy = searchContext.SearchSortBy; using (SearchFolder searchFolder = SearchFolder.Bind(mailboxSession, searchFolderId)) { int rowCount = 25; using (QueryResult queryResult = searchFolder.ConversationItemQuery(null, searchSortBy, SearchFolderConversationRetriever.itemSearchPropertyDefinitions)) { bool flag = true; while (flag) { object[][] rows = queryResult.GetRows(rowCount, out flag); if (rows == null || rows.Length == 0) { break; } for (int i = 0; i < rows.Length; i++) { if (totalItemCount < 50) { ConversationType conversationFromDataRow = SearchFolderConversationRetriever.GetConversationFromDataRow(searchContext, mailboxSession, rows[i], SearchFolderConversationRetriever.itemSearchPropertyDefinitionsOrderDictionary); list.Add(conversationFromDataRow); } totalItemCount++; } } } } return(list.ToArray()); }
public async void ConversationMutedUpdateConversations(long conversationId, ConversationType conversationType, long userId) { try { var userConversations = await GetUserConversationsAsync(userId, conversationType).ConfigureAwait(false); if (userConversations != null) { var conversation = userConversations.FirstOrDefault(conv => conv.ConversationId == conversationId); if (conversation == null) { userConversations = await conversationsService.GetUsersConversationsAsync(userId, conversationId, conversationType, 0).ConfigureAwait(false); conversation = userConversations.FirstOrDefault(conv => conv.ConversationId == conversationId); } if (conversation != null) { conversation.IsMuted = !conversation.IsMuted; UpdateUserConversations(userId, userConversations); } } } catch (Exception ex) { Logger.WriteLog(ex); } }
public static async Task <Conversation> AddConversation(ConversationType type, params string[] participants) { await UserService.AddUsers(participants); var conversation = new Conversation { Id = Guid.Empty, Type = type, Creator = null, Owner = null, Participants = UserService.Users.Where(u => participants.Contains(u.Nickname)).ToArray() }; switch (type) { case ConversationType.Passive: PassiveConversationService.Conversations.Add(conversation); break; case ConversationType.Active: break; } return(conversation); }
public async Task <bool> IsUserInConversationAsync(ConversationType conversationType, long conversationId, long userId) { using (MessengerDbContext context = contextFactory.Create()) { switch (conversationType) { case ConversationType.Dialog: { return(await context.Dialogs .AnyAsync(opt => (opt.FirstUID == userId) && opt.Id == conversationId).ConfigureAwait(false)); } case ConversationType.Chat: { return(await context.ChatUsers .AnyAsync(opt => opt.UserId == userId && opt.ChatId == conversationId && !opt.Deleted && !opt.Banned).ConfigureAwait(false)); } case ConversationType.Channel: { return(await context.ChannelUsers .AnyAsync(opt => opt.UserId == userId && opt.ChannelId == conversationId && !opt.Deleted && !opt.Banned).ConfigureAwait(false)); } default: return(false); } } }
private ConversationMessage CreateMessage(uint id, string message, ConversationType type) => new ConversationMessage { AboutId = LocalPlayerId, ObjectId = (int)id, EnumValue = type, Message = message };
private async Task <SendMessageResult> SendAsync(ConversationMsg msg, ConversationType conversationType) { var entity = await _conversationCtrlAppService.GetByIdAsync(msg.ConversationId); var conversationMsgAppService = _conversationMsgAppServiceFactory(msg.ConversationId); if (entity.HasValue && !entity.Value.IsDeleted) { if (entity.Value.Participants.Contains(msg.SenderId)) { await conversationMsgAppService.SendMessageAsync(msg); return(new SendMessageResult() { Success = true, Message = "发送消息成功", MessageId = msg.Id, SendTime = msg.Time }); } else { return new SendMessageResult() { Success = false, Message = conversationType == ConversationType.P2P ? "用户不属于此会话..." : "用户不在群组中..." } } } ;
public static ConversationBase BuildConversation(ConversationType type = ConversationType.Group, List <ConversationUser> Attendees = null) { ConversationBase conversation = null; if (Attendees == null) { throw new Exception("Please add contact"); } switch (type) { case ConversationType.Group: conversation = new GroupConversation { Id = Guid.NewGuid().GetHashCode(), Attendees = Attendees, ConversationType = type }; break; case ConversationType.Private: if (Attendees.Count > 2) { throw new Exception("Private conversations must be contained 2 users"); } conversation = new PrivateConversation { Id = Guid.NewGuid().GetHashCode(), Attendees = Attendees, ConversationType = type }; break; } foreach (var attendee in Attendees) { attendee.AttendedConversations.Add(conversation); } return(conversation); throw new NotImplementedException(); }
public async void SendMessagesUpdatedNoticeAsync( long conversationId, ConversationType conversationType, IEnumerable <MessageDto> messages, long userId, bool deleted, ClientConnection clientConnection) { try { switch (conversationType) { case ConversationType.Dialog: await SendDialogMessagesUpdatedNoticeAsync(messages, clientConnection, userId, conversationId, deleted).ConfigureAwait(false); break; case ConversationType.Chat: await SendChatMessagesUpdatedNoticeAsync(messages, conversationId, clientConnection, deleted).ConfigureAwait(false); break; case ConversationType.Channel: await SendChannelMessagesUpdatedNoticeAsync(messages, conversationId, clientConnection, deleted).ConfigureAwait(false); break; } } catch (Exception ex) { Logger.WriteLog(ex); } }
public bool Unserialize(JsonReader reader) { while (reader.Read()) { switch (reader.TokenType) { case JsonToken.PropertyName: if (reader.Value.Equals("conversationType")) { type = (ConversationType)JsonTools.getNextInt(reader); } else if (reader.Value.Equals("target")) { target = JsonTools.getNextString(reader); } else if (reader.Value.Equals("line")) { line = JsonTools.getNextInt(reader); } break; case JsonToken.EndObject: return(true); } } return(false); }
public async Task <IActionResult> Create(CreateConversationTypeViewModel createConversationType) { if (ModelState.IsValid) { var conversationType = new ConversationType { ConversationName = createConversationType.Name, ConversationDuration = createConversationType.Duration, School = _context.Schools.First(s => s.Id == Guid.Parse(HttpContext.Session.GetString("School"))) }; _context.Add(conversationType); foreach (var group in createConversationType.SelectedGroups) { ConversationTypeClaim conversationTypeClaim = new ConversationTypeClaim { ConversationType = conversationType, Group = _context.ApplicationUserGroups.First(g => g.Id == group) }; _context.Add(conversationTypeClaim); } await _context.SaveChangesAsync(); return(RedirectToAction("Index")); } createConversationType.Groups = new SelectList(_context.ApplicationUserGroups.OrderBy(g => g.GroupName).ToList(), "Id", "GroupName"); return(View(createConversationType)); }
public void Load(BinaryReader reader) { this.Name = reader.ReadString(); this.SetWorldVariables = reader.ReadStrings(); this.UnsetWorldVariables = reader.ReadStrings(); int count = reader.ReadInt32(); this.RequiredItems = new List <ItemDefinition>(count); for (int i = 0; i < count; i++) { ItemDefinition item = default(ItemDefinition); item.Load(reader); this.RequiredItems.Add(item); } this.RequiredWorldVariables = reader.ReadStrings(); this.RequiredNOWorldVariables = reader.ReadStrings(); this.RemoveRequiredItems = reader.ReadBoolean(); this.GiveItem = reader.ReadStrings(); this.YesCommand = reader.ReadString(); this.NoCommand = reader.ReadString(); this.ForwardCommand = reader.ReadString(); this.PostAction = (SpecialAction)reader.ReadInt16(); this.PreAction = (SpecialAction)reader.ReadInt16(); this.ConversationType = (ConversationType)reader.ReadInt16(); this.UnlockTeir = (Tier)reader.ReadInt16(); }
public async Task <PollDto> GetPollAsync(Guid pollId, long conversationId, ConversationType conversationType) { using (MessengerDbContext context = contextFactory.Create()) { var poll = await context.Polls .Include(opt => opt.Options) .ThenInclude(opt => opt.PollOptionVotes) .FirstOrDefaultAsync(opt => opt.PollId == pollId && opt.ConvertsationId == conversationId && opt.ConversationType == conversationType) .ConfigureAwait(false); if (poll == null) { var nodeId = await conversationsService.GetConversationNodeIdAsync(conversationType, conversationId).ConfigureAwait(false); var connection = connectionsService.GetNodeConnection(nodeId); if (connection != null) { var loadedPoll = await nodeRequestSender.GetPollInformationAsync(conversationId, conversationType, pollId, connection).ConfigureAwait(false); loadedPoll = await SavePollAsync(loadedPoll).ConfigureAwait(false); return(loadedPoll); } } return(PollConverter.GetPollDto(poll)); } }
public Conversation(CharacterName character, string conversationText, ConversationType conversationType) { this.Character = character; this.ConversationText = conversationText; this.ConversationType = conversationType; nextConversation = new Conversation[0]; }
public GetPollInformationNodeRequest(Guid pollId, ConversationType conversationType, long conversationId) { PollId = pollId; ConversationType = conversationType; ConversationId = conversationId; RequestType = Enums.NodeRequestType.GetPolls; }
public MessagesDeletedNodeNotice(long?conversationId, ConversationType conversationType, IEnumerable <MessageVm> messages, long requestorId) { Messages = messages.ToList(); ConversationType = conversationType; ConversationId = conversationId; NoticeCode = NodeNoticeCode.MessagesDeleted; RequestorId = requestorId; }
public DeleteConversationsNodeNotice(long conversationId, ConversationType conversationType, long nodeId, long requestingUserId) { RequestingUserId = requestingUserId; ConversationId = conversationId; ConversationType = conversationType; NodeId = nodeId; NoticeCode = Enums.NodeNoticeCode.DeleteConversations; }
public MessagesReadNodeNotice(IEnumerable <Guid> messagesId, ConversationType conversationType, long conversationOrUserId, long readerUserId) { MessagesId = messagesId.ToList(); ConversationType = conversationType; ConversationOrUserId = conversationOrUserId; ReaderUserId = readerUserId; NoticeCode = Enums.NodeNoticeCode.MessagesRead; }
private async Task HandleConversationTypeAsync(CallbackQuery query, ConversationType conversationType) { _conversationType = conversationType; await _telegramBotClient.AnswerCallbackQueryAsync(query.Id); await _telegramBotClient.SendTextMessageAsync(_chatId, "Okay no problem.", replyToMessageId : query.Message.MessageId); }
public ConversationActionNodeNotice(ConversationType conversationType, ConversationAction action, long conversationId, long userId, long?dialogUserId) { Action = action; ConversationType = conversationType; ConversationId = conversationId; UserId = userId; DialogUserId = dialogUserId; NoticeCode = Enums.NodeNoticeCode.ConversationAction; }
public void CreateConversation(ConversationType type = ConversationType.Group, List <ConversationUser> Attendees = null) { if (Attendees == null) { Attendees = Contacts.Select(x => x.ConversationUser).ToList(); } Attendees.Add(ConversationUser); var conversation = ConversationFactory.BuildConversation(type, Attendees); }
public PollingNodeNotice(Guid pollId, long conversationId, ConversationType conversationType, List <byte> optionsId, long votedUserId) { PollId = pollId; ConversationId = conversationId; ConversationType = conversationType; OptionsId = optionsId; VotedUserId = votedUserId; NoticeCode = Enums.NodeNoticeCode.Polling; }
public PollingNodeNotice(Guid pollId, long conversationId, ConversationType conversationType, List <PollVoteVm> signedOptions, long votedUserId) { PollId = pollId; ConversationId = conversationId; ConversationType = conversationType; SignedOptions = signedOptions; VotedUserId = votedUserId; NoticeCode = Enums.NodeNoticeCode.Polling; }
public MessagesDeletedNodeNotice(long?conversationId, ConversationType conversationType, MessageVm message, long requestorId) { Messages = new List <MessageVm> { message }; ConversationType = conversationType; ConversationId = conversationId; NoticeCode = NodeNoticeCode.MessagesDeleted; RequestorId = requestorId; }
public GetMessagesNodeRequest(ConversationType conversationType, long conversationId, Guid?messageId, List <AttachmentType> attachmentsTypes, bool?direction, int length) { Length = length; Direction = direction; MessageId = messageId; ConversationType = conversationType; ConversationId = conversationId; AttachmentsTypes = attachmentsTypes; RequestType = Enums.NodeRequestType.GetMessages; }
public void Init(string userId, ConversationType mode, string conversationId, IErpServiceCallback callback) { this.ConversationUser = new User() { Id = userId }; this.ConversationId = conversationId; this.Mode = mode; this.Callback = callback; }
public async Task <IActionResult> Create(CreateConversationTypeViewModel createConversationType) { if (ModelState.IsValid) { var conversationType = new ConversationType { ConversationName = createConversationType.Name, ConversationDuration = createConversationType.Duration }; if (User.IsInRole("Eigenaar") && HttpContext.Session.GetString("School") == null) { conversationType.School = _context.Schools.First(s => s.Id == Guid.Parse(createConversationType.SelectedSchool)); } else { conversationType.School = _context.Schools.First(s => s.Id == Guid.Parse(HttpContext.Session.GetString("School"))); } _context.Add(conversationType); foreach (var group in createConversationType.SelectedGroups) { ConversationTypeClaim conversationTypeClaim = new ConversationTypeClaim { ConversationType = conversationType, Group = _context.ApplicationUserGroups.First(g => g.Id == group) }; _context.Add(conversationTypeClaim); } await _context.SaveChangesAsync(); return(RedirectToAction("Index")); } createConversationType.Groups = new List <SelectListItem>(); var groups = _context.ApplicationUserGroups.Include(g => g.School).OrderBy(g => g.GroupName).GroupBy(g => g.School).ToList(); foreach (var groupList in groups) { var selectGroup = new SelectListGroup { Name = groupList.Key.Name, Disabled = false }; foreach (var group in groupList) { ((List <SelectListItem>)createConversationType.Groups).Add(new SelectListItem { Disabled = false, Group = selectGroup, Value = group.Id.ToString(), Text = group.GroupName }); } //((List<SelectListItem>)conversationTypeModel.Groups).Add(new SelectListItem { Text = group.GroupName, Value = group.Id.ToString(), Selected = true }); } createConversationType.Schools = new SelectList(_context.Schools.ToList(), "Id", "Name"); return(View(createConversationType)); }
// Token: 0x06000F5C RID: 3932 RVA: 0x0003B790 File Offset: 0x00039990 private static ConversationType GetConversationFromDataRow(OwaSearchContext searchContext, MailboxSession mailboxSession, object[] row, Dictionary <PropertyDefinition, int> orderDictionary) { ConversationType conversationType = new ConversationType(); conversationType.InstanceKey = SearchFolderDataRetrieverBase.GetItemProperty <byte[]>(row, orderDictionary[ItemSchema.InstanceKey], null); ConversationId itemProperty = SearchFolderDataRetrieverBase.GetItemProperty <ConversationId>(row, orderDictionary[ConversationItemSchema.ConversationId], null); conversationType.ConversationId = new ItemId(IdConverter.ConversationIdToEwsId(mailboxSession.MailboxGuid, itemProperty), null); conversationType.ConversationTopic = SearchFolderDataRetrieverBase.GetItemProperty <string>(row, orderDictionary[ConversationItemSchema.ConversationTopic]); conversationType.UniqueRecipients = SearchFolderDataRetrieverBase.GetItemProperty <string[]>(row, orderDictionary[ConversationItemSchema.ConversationMVTo]); conversationType.UniqueSenders = SearchFolderDataRetrieverBase.GetItemProperty <string[]>(row, orderDictionary[ConversationItemSchema.ConversationMVFrom]); conversationType.LastDeliveryTime = SearchFolderDataRetrieverBase.GetDateTimeProperty(searchContext.RequestTimeZone, row, orderDictionary[ConversationItemSchema.ConversationLastDeliveryTime]); conversationType.Categories = SearchFolderDataRetrieverBase.GetItemProperty <string[]>(row, orderDictionary[ConversationItemSchema.ConversationCategories]); if (SearchFolderDataRetrieverBase.IsPropertyDefined(row, orderDictionary[ConversationItemSchema.ConversationFlagStatus])) { FlagStatus itemProperty2 = (FlagStatus)SearchFolderDataRetrieverBase.GetItemProperty <int>(row, orderDictionary[ConversationItemSchema.ConversationFlagStatus], 0); if (itemProperty2 != FlagStatus.NotFlagged) { conversationType.FlagStatus = new FlagType { FlagStatus = itemProperty2 }.FlagStatus; } } conversationType.HasAttachments = new bool?(SearchFolderDataRetrieverBase.GetItemProperty <bool>(row, orderDictionary[ConversationItemSchema.ConversationHasAttach])); conversationType.HasIrm = new bool?(SearchFolderDataRetrieverBase.GetItemProperty <bool>(row, orderDictionary[ConversationItemSchema.ConversationHasIrm])); conversationType.MessageCount = new int?(SearchFolderDataRetrieverBase.GetItemProperty <int>(row, orderDictionary[ConversationItemSchema.ConversationMessageCount])); conversationType.GlobalMessageCount = new int?(SearchFolderDataRetrieverBase.GetItemProperty <int>(row, orderDictionary[ConversationItemSchema.ConversationGlobalMessageCount])); conversationType.UnreadCount = new int?(SearchFolderDataRetrieverBase.GetItemProperty <int>(row, orderDictionary[ConversationItemSchema.ConversationUnreadMessageCount])); conversationType.GlobalUnreadCount = new int?(SearchFolderDataRetrieverBase.GetItemProperty <int>(row, orderDictionary[ConversationItemSchema.ConversationGlobalUnreadMessageCount])); conversationType.Size = new int?(SearchFolderDataRetrieverBase.GetItemProperty <int>(row, orderDictionary[ConversationItemSchema.ConversationMessageSize])); conversationType.ItemClasses = SearchFolderDataRetrieverBase.GetItemProperty <string[]>(row, orderDictionary[ConversationItemSchema.ConversationMessageClasses]); conversationType.ImportanceString = ((ImportanceType)SearchFolderDataRetrieverBase.GetItemProperty <int>(row, orderDictionary[ConversationItemSchema.ConversationImportance], 1)).ToString(); StoreId[] itemProperty3 = SearchFolderDataRetrieverBase.GetItemProperty <StoreId[]>(row, orderDictionary[ConversationItemSchema.ConversationItemIds], new StoreId[0]); conversationType.ItemIds = Array.ConvertAll <StoreId, ItemId>(itemProperty3, (StoreId s) => new ItemId(SearchFolderDataRetrieverBase.GetEwsId(s, mailboxSession.MailboxGuid), null)); StoreId[] itemProperty4 = SearchFolderDataRetrieverBase.GetItemProperty <StoreId[]>(row, orderDictionary[ConversationItemSchema.ConversationGlobalItemIds], new StoreId[0]); conversationType.GlobalItemIds = Array.ConvertAll <StoreId, ItemId>(itemProperty4, (StoreId s) => new ItemId(SearchFolderDataRetrieverBase.GetEwsId(s, mailboxSession.MailboxGuid), null)); conversationType.LastModifiedTime = SearchFolderDataRetrieverBase.GetDateTimeProperty(searchContext.RequestTimeZone, row, orderDictionary[StoreObjectSchema.LastModifiedTime]); conversationType.Preview = SearchFolderDataRetrieverBase.GetItemProperty <string>(row, orderDictionary[ConversationItemSchema.ConversationPreview]); IconIndex itemProperty5 = (IconIndex)SearchFolderDataRetrieverBase.GetItemProperty <int>(row, orderDictionary[ConversationItemSchema.ConversationReplyForwardState]); if (itemProperty5 > (IconIndex)0) { conversationType.IconIndexString = itemProperty5.ToString(); } itemProperty5 = (IconIndex)SearchFolderDataRetrieverBase.GetItemProperty <int>(row, orderDictionary[ConversationItemSchema.ConversationGlobalReplyForwardState]); if (itemProperty5 > (IconIndex)0) { conversationType.GlobalIconIndexString = itemProperty5.ToString(); } return(conversationType); }
public async void SendMessagesDeletedNodeNoticeAsync(long conversationId, ConversationType conversationType, List <MessageVm> messages, long requestorId) { try { MessagesDeletedNodeNotice notice = new MessagesDeletedNodeNotice(conversationId, conversationType, messages, requestorId); List <long> nodesIds = messages.FirstOrDefault()?.NodesId?.ToList(); await SendNoticeToNodesAsync(notice, nodesIds).ConfigureAwait(false); } catch (Exception ex) { Logger.WriteLog(ex); } }
public void SendMessage(string targetId, string senderId, JObject jobj, ConversationType type) { if (type == ConversationType.PRIVATE) { int messageId = Rcsdk.SaveMessage(targetId, 1, "RC:TxtMsg", senderId, jobj.ToString(), "", "", false, 0); Rcsdk.sendMessage(targetId, 1, 2, "RC:TxtMsg", jobj.ToString(), "", "", messageId, _sendCallBack); } else if (type == ConversationType.DISCUSSION) { int messageId1 = Rcsdk.SaveMessage(targetId, 2, "RC:TxtMsg", senderId, jobj.ToString(), "", "", false, 0); Rcsdk.sendMessage(targetId, 2, 3, "RC:TxtMsg", jobj.ToString(), "", "", messageId1, _sendCallBack); } }
public async void SendConversationActionNoticeAsync(long userId, ConversationType conversationType, long conversationId, ConversationAction action) { try { List <long> usersIds = null; ConversationActionNotice notice = null; switch (conversationType) { case ConversationType.Dialog: { var users = await loadDialogsService.GetDialogUsersAsync(conversationId).ConfigureAwait(false); var secondUser = users.FirstOrDefault(opt => opt.Id != userId); usersIds = new List <long> { secondUser.Id.Value }; var dialogId = await loadDialogsService.GetMirrorDialogIdAsync(conversationId); notice = new ConversationActionNotice(dialogId, ConversationType.Dialog, userId, action); } break; case ConversationType.Chat: { usersIds = await loadChatsService.GetChatUsersIdAsync(conversationId); notice = new ConversationActionNotice(conversationId, ConversationType.Chat, userId, action); } break; case ConversationType.Channel: { usersIds = await loadChannelsService.GetChannelUsersIdAsync(conversationId); notice = new ConversationActionNotice(conversationId, ConversationType.Channel, null, action); } break; default: return; } usersIds.Remove(userId); var clientConnections = connectionsService.GetClientConnections(usersIds); await SendNoticeToClientsAsync(clientConnections, notice); } catch (Exception ex) { Logger.WriteLog(ex); } }
public async Task <bool> CanUserGetMessageAsync(ConversationType conversationType, long?conversationId, long?userId) { if (userId == null) { return(true); } using (MessengerDbContext context = contextFactory.Create()) { switch (conversationType) { case ConversationType.Chat: { return(await context.ChatUsers.AnyAsync(chatUser => chatUser.Banned == false && chatUser.Deleted == false && chatUser.ChatId == conversationId && chatUser.UserId == userId) .ConfigureAwait(false)); } case ConversationType.Dialog: { if (conversationId == null) { return(true); } else { return(await context.Dialogs.AnyAsync(dialog => (dialog.FirstUID == userId || dialog.SecondUID == userId) && dialog.Id == conversationId) .ConfigureAwait(false)); } } case ConversationType.Channel: { return(await context.ChannelUsers.AnyAsync(channelUser => channelUser.ChannelId == conversationId && channelUser.UserId == userId && channelUser.Banned == false && channelUser.Deleted == false) .ConfigureAwait(false)); } default: return(false); } } }
public ConversationRoom(ConversationType type, UserAccount myAccount, Contact contact) { this.ConversationType = type; this.myAccount = myAccount; this.FirstName = contact.FirstName; this.Photo = contact.Photo; this.UserId = contact.UserId; this.UserName = contact.UserName; if (contact.Conversations != null) { this.Conversations = contact.Conversations; } }
public ConversationWindow(Conversation conversation, LyncClient client, ContactInfo contact, ConversationType conversationType) { InitializeComponent(); //this.ApplyThemes(); this.client = client; this.conversation = conversation; this.Contact = contact; this.conversationType = conversationType; this.Title = contact.DisplayName; InitializeConversation(); }
public Question CheckForActiveQuestion(ConversationType mode, string userId, string conversationId) { foreach (Question question in ActiveQuestions) { if ((mode == question.Mode) && string.Equals(userId, question.UserId) && string.Equals(conversationId, question.ConversationId)) { this.ActiveQuestions.Remove(question); question.State.IsQuestion = false; question.State.QuestionText = string.Empty; return question; } } return null; }
public void ProcessCommand(string command, string userId, ConversationType mode, string conversationId, IErpServiceCallback callback) { ConversationContext context = ServiceLocator.GetInstance<ConversationContext>(); Question question = null; List<Token> tokens = new List<Token>(); command = command.TrimEnd(new char[] {'.', '!', '?'}); string localCommand = command.ToLower().Trim(); context.Init(userId, mode, conversationId, callback); var tokenManager = ServiceLocator.GetInstance<TokenManager>(); var buckets = tokenManager.TokenizeInput(localCommand, userId); question = this.QuestionManager.CheckForActiveQuestion(mode, userId, conversationId); if (question != null) { question.State.Context = command; context.Say(question.State, null); return; } RuleMethod ruleMethod = RuleManager.LocateMatchingRule(buckets, context); if (ruleMethod != null) { ruleMethod.Rule.Invoke(null, ruleMethod.PassIns); } else { ErpResultWrapper wrapper = new ErpResultWrapper(); wrapper.IsQuestion = true; wrapper.QuestionText = Constants.UnderstandFailure; context.Say(wrapper, null); } }
public void SendMessage(string targetId, string senderId, JObject jobj, ConversationType type) { _messaging.SendMessage(targetId, senderId, jobj, type); }
public void SendImageMsg(string targetId, string senderId, JObject msgJobj, ConversationType type, out string msgid) { if (type == ConversationType.PRIVATE) { int messageId = Rcsdk.SaveMessage(targetId, 1, "RC:ImgMsg", senderId, msgJobj.ToString(), "", "", false, 0); msgid = messageId.ToString(); Rcsdk.sendMessage(targetId, 1, 2, "RC:ImgMsg", msgJobj.ToString(), "", "", messageId, _sendImgMsgCallBack); } else if (type == ConversationType.DISCUSSION) { int messageId1 = Rcsdk.SaveMessage(targetId, 2, "RC:ImgMsg", senderId, msgJobj.ToString(), "", "", false, 0); msgid = messageId1.ToString(); Rcsdk.sendMessage(targetId, 2, 3, "RC:ImgMsg", msgJobj.ToString(), "", "", messageId1, _sendImgMsgCallBack); } else { msgid = string.Empty; } }
private void ShowConversationDialog(Conversation conversation, ContactInfo contactInfo, ConversationType conversationType) { Dispatcher.BeginInvoke((Action)(() => { var window = new ConversationWindow(conversation, this.lyncService.Client, contactInfo, conversationType); this.currentConversationWindow = window; window.ShowDialog(); })); }
public bool StartConversation(string contactUri, ConversationType conversationType) { var contact = this.searchResultSubscription.Contacts.FirstOrDefault(x => x.Uri == contactUri); if (contact == null) { return false; } //creates a new conversation Conversation conversation = null; try { this.currentConversationType = conversationType; conversation = client.ConversationManager.AddConversation(); } catch (LyncClientException e) { Console.WriteLine("LyncSevice Error: " + e.Message); } catch (SystemException systemException) { if (LyncModelExceptionHelper.IsLyncException(systemException)) { // Log the exception thrown by the Lync Model API. Console.WriteLine("LyncSevice Error: " + systemException); } else { // Rethrow the SystemException which did not come from the Lync Model API. throw; } } //Adds a participant to the conversation //the window created for this conversation will handle the ParticipantAdded events if (conversation != null) { try { conversation.AddParticipant(contact); } catch (LyncClientException lyncClientException) { Console.WriteLine("LyncSevice Error: " + lyncClientException); } catch (SystemException systemException) { if (LyncModelExceptionHelper.IsLyncException(systemException)) { // Log the exception thrown by the Lync Model API. Console.WriteLine("LyncSevice Error: " + systemException); } else { // Rethrow the SystemException which did not come from the Lync Model API. throw; } } } return true; }
public ConversationEventArgs(Conversation conversation, ContactInfo contactInfo, ConversationType conversationType) { this.Conversation = conversation; this.ContactInfo = contactInfo; this.ConversationType = conversationType; }
public static Conversation makeConversation(ConversationType conversationTag) { switch (conversationTag) { case ConversationType.LEVEL1: { return makeLevel1(); } case ConversationType.LEVEL2: { return makeLevel2(); } case ConversationType.LEVEL3: { return makeLevel3(); } case ConversationType.LEVEL4: { return makeLevel4(); } case ConversationType.LEVEL5: { return makeLevel5(); } case ConversationType.LEVEL6: { return makeLevel6(); } case ConversationType.LEVEL7: { return makeLevel7(); } case ConversationType.LEVEL8: { return makeLevel8(); } case ConversationType.LEVEL9: { return makeLevel9(); } case ConversationType.BATTLE_FIRST: { return makeBattleFirst(); } case ConversationType.BATTLE_BOSS: { return makeBattleBoss(); } case ConversationType.END_WIN: { return makeEndWin(); } case ConversationType.END_LOSE: { return makeEndLose(); } default: { return null; } } }
public void SendFileMsg(string targetId, string senderId, JObject msgJobj, ConversationType type, out string msgid) { if (type == ConversationType.PRIVATE) { int messageId = Rcsdk.SaveMessage(targetId, 1, "bhikku:file", senderId, msgJobj.ToString(), "", "", false, 0); msgid = messageId.ToString(); Rcsdk.sendMessage(targetId, 1, 2, "bhikku:file", msgJobj.ToString(), "", "", messageId, null); } else if (type == ConversationType.DISCUSSION) { int messageId = Rcsdk.SaveMessage(targetId, 2, "bhikku:file", senderId, msgJobj.ToString(), "", "", false, 0); msgid = messageId.ToString(); Rcsdk.sendMessage(targetId, 2, 3, "bhikku:file", msgJobj.ToString(), "", "", messageId, null); } else { msgid = string.Empty; } }
public void SendFileMessage(string targetId, string senderId, JObject msgJobj, ConversationType type, out string msgid) { _messaging.SendFileMsg(targetId, senderId, msgJobj, type, out msgid); }
public void SendImage(string targetId, string senderId, byte[] srcImgBytes, ConversationType type, Action<String> uploadingCallBack, Action<String> uploadedCallBack) { _messaging.SendImage(targetId, senderId, srcImgBytes, type, uploadingCallBack, uploadedCallBack); }
public void SendImage(string targetId, string senderId, byte[] srcImgBytes, ConversationType type, Action<string> uploadingCallBack, Action<string> uploadedCallBack) { ImageListenerEventHandler imageCallBack = new ImageListenerEventHandler(uploadedCallBack); ImageListenerEventHandler imageProcessCallBack = new ImageListenerEventHandler(uploadingCallBack); Rcsdk.UpLoadFile(targetId, 1, 1, srcImgBytes, srcImgBytes.Length, imageCallBack, imageProcessCallBack); }
public void GetHistoryMessage(string userId, ConversationType type, int lastId = -1) { _messaging.GetHistoryMessage(userId, type, lastId); }
public void GetHistoryMessage(string targetId, ConversationType type, int lastId = -1) { if (type == ConversationType.PRIVATE) { MessageInfoEventHandler get_paged_callback = new MessageInfoEventHandler(get_paged_messageex_callback_delegate.get_paged_messagex_call_back); Rcsdk.GetHistoryMessages(targetId, 1, "", lastId, 5, get_paged_callback); } else if (type == ConversationType.DISCUSSION) { MessageInfoEventHandler get_paged_callback = new MessageInfoEventHandler(get_paged_messageex_callback_delegate.get_paged_messagex_call_back); Rcsdk.GetHistoryMessages(targetId, 2, "", lastId, 5, get_paged_callback); } }