Ejemplo n.º 1
0
        private async Task MucClient_PrivateMessageReceived(object Sender, RoomOccupantMessageEventArgs e)
        {
            RoomNode RoomNode = await this.GetRoomNode(e.RoomId, e.Domain);

            OccupantNode Occupant = RoomNode.GetOccupantNode(e.NickName, null, null, null);

            MainWindow.ParseChatMessage(e, out string Message, out bool IsMarkdown, out DateTime Timestamp);

            MainWindow.currentInstance.MucPrivateChatMessage(e.From, XmppClient.GetBareJID(e.To), Message, e.ThreadID,
                                                             IsMarkdown, Timestamp, Occupant, e.From);
        }
Ejemplo n.º 2
0
        internal async Task MucClient_OccupantPresence(object Sender, UserPresenceEventArgs e)
        {
            RoomNode RoomNode = await this.GetRoomNode(e.RoomId, e.Domain);

            OccupantNode OccupantNode = RoomNode.GetOccupantNode(e.NickName, e.Affiliation, e.Role, e.FullJid);
            ChatView     View         = null;

            if (!OccupantNode.Availability.HasValue || e.Availability != OccupantNode.Availability.Value)
            {
                OccupantNode.Availability = e.Availability;
                OccupantNode.OnUpdated();

                View = MainWindow.currentInstance.FindRoomView(e.From, XmppClient.GetBareJID(e.To));

                if (!(View is null))
                {
                    switch (OccupantNode.Availability)
                    {
                    case Availability.Online:
                        View.Event("Online.", e.NickName, string.Empty);
                        break;

                    case Availability.Offline:
                        View.Event("Offline.", e.NickName, string.Empty);
                        break;

                    case Availability.Away:
                        View.Event("Away.", e.NickName, string.Empty);
                        break;

                    case Availability.Chat:
                        View.Event("Ready to chat.", e.NickName, string.Empty);
                        break;

                    case Availability.DoNotDisturb:
                        View.Event("Busy.", e.NickName, string.Empty);
                        break;

                    case Availability.ExtendedAway:
                        View.Event("Away (extended).", e.NickName, string.Empty);
                        break;
                    }
                }
            }

            await this.MucClient_RoomPresence(Sender, e, View);
        }