0

多年来我一直在尝试调试它。但我无法将其发送到会议。发送正常的聊天工作。但不是在会议上。这是我的代码。

_connection.Send(new agsXMPP.protocol.client.Message(new Jid(CurrentContactWindow.Jid), MessageType.chat, Txt_Message.Text));

我使用此代码检索 jid 进行正常聊天。

void XmppCon_OnMessage(object sender, agsXMPP.protocol.client.Message msg)
    {
        if (msg.Body != null)
        {
            if (msg.Type == MessageType.groupchat)
            {
                System.Windows.Application.Current.Dispatcher.Invoke(DispatcherPriority.Normal, (Action)delegate()
                {
                    _groupMessageView.Add(new GroupMessageView() { Name = msg.From, Message = msg.Body, IsMe = false, DateCreated = DateTime.Now });
                });
                ConstructChatView(false);
            }
            else
            {//this is for normal chat
                var emailMatches = new Regex(@"\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*", RegexOptions.IgnoreCase).Matches(new Jid(msg.From.ToString()));
                var fromJid = emailMatches.Count > 0 ? emailMatches[0].ToString() : "";

                var message = new Nesv.vChat.Domain.Models.Message()
                {
                    GroupName = fromJid,
                    From = fromJid,
                    Body = msg.Body,
                    IsFromMe = false
                };
                UpdateMessageOnWindow(message);
            }
        }

        if (msg.Type == MessageType.normal)
        {
            try
            {
                var conference = (Conference)msg.LastNode;
                var chatroom = conference.Chatroom;
                var mucManager = new MucManager(_connection);
                mucManager.JoinRoom(chatroom, _connection.Username, true);


                //Get users
                _connection.PresenceGrabber.Add(chatroom, new PresenceCB(PresenceCallback), null);

                System.Windows.Application.Current.Dispatcher.Invoke(DispatcherPriority.Normal, (Action)delegate()
                {//this is for conference/groupchat
                    _contactView.Add(new ContactView() { Jid = msg.From, Name = chatroom.User, isGroupChat = true });
                });


               // mucManager.

                // sample send message
                //_connection.Send(new agsXMPP.protocol.client.Message(chatroom, MessageType.groupchat, "XOXOXOXOXOX"));
            }
            catch { }
        }
        PrintEvent(msg.Body);
    }

有任何想法吗?谢谢!

4

1 回答 1

1

尝试这个:

_connection.Send(new agsXMPP.protocol.client.Message
(new Jid(CurrentContactWindow.Jid),
agsXMPP.protocol.client.MessageType.groupchat, Txt_Message.Text));
于 2013-06-22T07:21:57.890 回答