public void onMUCRoomSubjectMessage(MUCRoomSubjectMessage mucRoomSubject) { string to = Utils.getBareJidFromFullJid(mucRoomSubject.getTo()); string from = Utils.getBareJidFromFullJid(mucRoomSubject.getFrom()); string id = ChatTable.generateId(from, to); MUCDBManager.INSTANCE.setMUCSubject(id, mucRoomSubject.SUBJECT, true); }
private void saveSubject() { subject_stbx.onStartSaving(); notificationBanner_ian.Dismiss(); string from = Client.getXMPPAccount().getIdAndDomain() + '/' + MUCInfo.nickname; string to = Chat.chatJabberId; string id = Chat.id; MUCRoomSubjectMessage msg = new MUCRoomSubjectMessage(from, to, subject_stbx.Text); Task t = Client.sendAsync(msg, true); Task.Run(async() => { MUCDBManager.INSTANCE.setMUCSubject(id, msg.SUBJECT, false); await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { notificationBanner_ian.Show("Successfully updated the room subject!", 5000); subject_stbx.onSavingDone(); }); }); }
public void OnMUCRoomSubjectMessage(MUCRoomSubjectMessage mucRoomSubject) { string to = Utils.getBareJidFromFullJid(mucRoomSubject.getTo()); string from = Utils.getBareJidFromFullJid(mucRoomSubject.getFrom()); ChatModel chat; using (SemaLock semaLock = DataCache.INSTANCE.NewChatSemaLock()) { chat = DataCache.INSTANCE.GetChat(to, from, semaLock); } if (chat is null || chat.muc is null || (chat.muc.state == MucState.DISCONNECTED && string.Equals(chat.muc.subject, mucRoomSubject.SUBJECT))) { return; } using (SemaLock semaLock = chat.muc.NewSemaLock()) { chat.muc.subject = mucRoomSubject.SUBJECT; using (MainDbContext ctx = new MainDbContext()) { ctx.Update(chat.muc); } } }