• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# client.Message类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中agsXMPP.protocol.client.Message的典型用法代码示例。如果您正苦于以下问题:C# Message类的具体用法?C# Message怎么用?C# Message使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Message类属于agsXMPP.protocol.client命名空间,在下文中一共展示了Message类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: ConnectionOnMessage

 private void ConnectionOnMessage(object sender, Message msg)
 {
     OnMessageReceived(new MessageReceivedArgs
     {
         Message = Create(msg)
     });
 }
开发者ID:Irdis,项目名称:VSTalk,代码行数:7,代码来源:XmppClientMessageProvider.cs


示例2: should_parse_room_message_into_proper_type

        public void should_parse_room_message_into_proper_type()
        {
            var message = new agsXMPP.protocol.client.Message() {From = "[email protected]/Dharma Soft", Body = "Message Body"};

            var xmppMessage = MessageFactory.Create(message);
            Assert.That(xmppMessage.MessageType,Is.EqualTo(MessageType.RoomMessage));
        }
开发者ID:SimplyChris,项目名称:LibHipChat,代码行数:7,代码来源:HipChatXmppUtilityTests.cs


示例3: IsContentMessage

 public static bool IsContentMessage(Message msg)
 {
     //A "content message" -- that is, a message stanza whose primary meaning is contained in
     //standard messaging content such as the XMPP <body/> or any other properly-namespaced child
     //element(s) other than those defined for chat state notifications in this specification.
     return !string.IsNullOrEmpty(msg.Body) || msg.HasTag(XamlBody.TAG);
 }
开发者ID:Irdis,项目名称:VSTalk,代码行数:7,代码来源:MessageUtil.cs


示例4: Create

        public Message Create(FlowDocument document)
        {
            var xdoc = new XmlDocument();
            xdoc.LoadXml(XamlWriter.Save(document));

            var newAttr = xdoc.CreateAttribute("xml:space");
            newAttr.Value = "preserve";

            xdoc.DocumentElement.Attributes.Append(newAttr);
            var sb = new StringBuilder(xdoc.OuterXml);
            //see: http://stackoverflow.com/questions/2624068/wpf-richtextbox-xamlwriter-behaviour
            var xamlPart = sb.Replace("{}{", "{").ToString();

            var txtPart = new TextRange(document.ContentStart, document.ContentEnd)
                    .Text
                    .TrimEnd();
            var xaml = new XamlBody();
            xaml.Content = xamlPart;
            var msg = new Message
            {
                    Body = txtPart,
            };
            msg.AddChild(xaml);
            return msg;
        }
开发者ID:Irdis,项目名称:VSTalk,代码行数:25,代码来源:XamlMessageBuilder.cs


示例5: CanProcess

        public bool CanProcess(Message message)
        {
            if (message == null)
                return false;

            return !string.IsNullOrEmpty(CommandProcessor.GetCommandFromMessage(message.Body));
        }
开发者ID:kevinmcmahon,项目名称:chatsworth,代码行数:7,代码来源:CommandMessageHandler.cs


示例6: ProcessMessage

        public void ProcessMessage(Message message)
        {
            if (!CanProcess(message))
                return;

            ChatMember from = _directory.LookUp(message.From.Bare);

            if (from == null)
                return;

            if (from.ActiveInChat)
            {
                IEnumerable<ChatMember> recipients = _directory.GetToListForSubscriber(message.From.Bare);

                foreach (ChatMember member in recipients)
                {
                    if (member.ActiveInChat)
                    {
                        _communicator.SendMessage(member.Jid, string.Format("[\"{0}\"] {1}", from.Alias, message.Body));
                    }
                }
            }
            else
            {
                _communicator.SendMessage(from.Jid, NOT_ACTIVE_IN_CHAT_MESSAGE);
            }
        }
开发者ID:kevinmcmahon,项目名称:chatsworth,代码行数:27,代码来源:ChatMessageHandler.cs


示例7: ProcessMessage

        protected virtual void ProcessMessage(Message message)
        {
            if (message.Body == null) return;

            try
            {
                var msgObj = MessageFactory.GetMessageFromXml(message.Body);
                if (msgObj == null) return;

                var msgType = msgObj.GetType();

                if (msgType == typeof(GameStartMessage))
                    ProcessGameStartMessage(message.From, (GameStartMessage)msgObj);
                if (msgType == typeof(GameOverMessage))
                    ProcessGameOverMessage(message.From, (GameOverMessage)msgObj);
                if (msgType == typeof(TurnResultMessage))
                    ProcessTurnResultMessage(message.From, (TurnResultMessage)msgObj);
                if (msgType == typeof(TurnStartMessage))
                    ProcessTurnStartMessage(message.From, (TurnStartMessage)msgObj);
                if (msgType == typeof(RegistrationCompleteMessage))
                    ProcessRegistrationCompleteMessage(message.From);
                if (msgType == typeof(TournamentStartedMessage))
                    ProcessTournamentStartedMessage(message.From, (TournamentStartedMessage)msgObj);
                if (msgType == typeof(PlayerMoveMessage))
                    ProcessPlayerMoveMessage(message.From, (PlayerMoveMessage)msgObj);
                if (msgType == typeof(RegisterMessage))
                    ProcessRegisterMessage(message.From);
            }
            catch (Exception) { }
        }
开发者ID:micahlmartin,项目名称:RPS-Xmpp,代码行数:30,代码来源:XmppHostBase.cs


示例8: Message1

        private void Message1()
        {
            // transient message (will not be stored offline if the server support AMP)

            /*
            <message to='[email protected]'
                     from='[email protected]/elsinore'
                     type='chat'
                     id='chatty1'>
              <body>Who&apos;s there?</body>
              <amp xmlns='http://jabber.org/protocol/amp'>
                <rule action='drop' condition='deliver' value='stored'/>
              </amp>
            </message>
            */

            agsXMPP.protocol.client.Message msg = new agsXMPP.protocol.client.Message();
            msg.To = new Jid("[email protected]");
            msg.From = new Jid("[email protected]/elsinore");
            msg.Type = MessageType.chat;
            msg.Id = "chatty1";

            msg.Body = "Who&apos;s there?";

            Amp amp = new Amp();
            Rule rule = new Rule(Condition.Deliver, "stored", agsXMPP.protocol.extensions.amp.Action.drop);
            amp.AddRule(rule);

            msg.AddChild(amp);

            Program.Print(msg);
        }
开发者ID:phiree,项目名称:dzdocs,代码行数:32,代码来源:Message.cs


示例9: Execute

 public void Execute(Message message)
 {
     if(_directory.RemoveSubscriber(message.From.Bare))
     {
         _communicator.SendMessage(message.From.Bare,REMOVED_CONFIRMATION_MESSAGE);
     }
 }
开发者ID:kevinmcmahon,项目名称:chatsworth,代码行数:7,代码来源:LeaveCommand.cs


示例10: XmppConnection_OnMessage

        void XmppConnection_OnMessage(object sender, Message msg)
        {
            if (!roomName.Contains(msg.From.User))
                return;

            if (msg.From.Resource == Client.LoginPacket.AllSummonerData.Summoner.Name)
                return;

            Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
            {
                if (msg.Body == "This room is not anonymous")
                    return;

                var tr = new TextRange(ChatText.Document.ContentEnd, ChatText.Document.ContentEnd)
                {
                    Text = msg.From.Resource + ": "
                };
                tr.ApplyPropertyValue(TextElement.ForegroundProperty, Brushes.Turquoise);

                tr = new TextRange(ChatText.Document.ContentEnd, ChatText.Document.ContentEnd)
                {
                    Text = msg.Body.Replace("<![CDATA[", "").Replace("]]>", string.Empty) + Environment.NewLine
                };
                tr.ApplyPropertyValue(TextElement.ForegroundProperty, Brushes.White);

                ChatText.ScrollToEnd();
            }));
        }
开发者ID:osiato,项目名称:LegendaryClient,代码行数:28,代码来源:GroupChatItem.xaml.cs


示例11: MessageCallBack

        private void MessageCallBack(object sender, Message msg, object data)
        {
            if (msg.Body != null)
            {
                var payload = new MessagePayload();
                payload.Attachments = new List<MessagePayloadAttachment>();
                if (!msg.Body.Contains("@everyone"))
                {
                    msg.Body = string.Concat("@everyone: ", msg.Body);
                }
                payload.Attachments.Add(new MessagePayloadAttachment()
                {
                    Text = msg.Body.Replace("@everyone", "@channel"),
                    Title = string.Format("{0}: Message from {1}", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), "Marvin"),
                    Colour = "#ff0066"
                });
                Plugin.SendToRoom(payload, Properties.Settings.Default.FleetRoomName, Properties.Settings.Default.SlackWebhook, Properties.Settings.Default.FleetBotName);

                if (msg.Body.Contains("bog_all"))
                {
                    foreach (var hook in Properties.Settings.Default.DiscordLinkSlackWebhooks)
                    {
                        Plugin.SendToRoom(payload, Properties.Settings.Default.FleetRoomName, hook, Properties.Settings.Default.FleetBotName);
                    }
                }
            }
        }
开发者ID:R3MUSDevPack,项目名称:ReconnectedServerStuff,代码行数:27,代码来源:JabberListener.cs


示例12: button2_Click

        //������Ϣ
        private void button2_Click(object sender, EventArgs e)
        {
            agsXMPP.protocol.client.Message msg = new agsXMPP.protocol.client.Message();

            if (listBox1.SelectedIndex > 0)
            {
                msg.Type = MessageType.chat;
                msg.Body = richTextBox2.Text;
                msg.From = new Jid(con.Username, "localhost", "resource");
                msg.To = new Jid(name, "localhost", con.Username);

                con.Send(msg);

                richTextBox2.Text = "";
            }
            else
            {
                msg.Type = MessageType.groupchat;
                msg.Body = richTextBox2.Text;
                msg.From = new Jid(con.Username, "localhost", "resource");
                msg.To = new Jid(con.Server, "localhost", con.Username);

                con.Send(msg);

                richTextBox2.Text = "";
            }
        }
开发者ID:phiree,项目名称:dzdocs,代码行数:28,代码来源:Form2.cs


示例13: cmdSend_Click

 private void cmdSend_Click()
 {
     // Send a message
     agsXMPP.protocol.client.Message msg = new agsXMPP.protocol.client.Message();
     msg.Type = agsXMPP.protocol.client.MessageType.chat;
     msg.To = new Jid("");
     msg.Body = "";
 }
开发者ID:soufatn,项目名称:Windows8-XMPP-Client,代码行数:8,代码来源:MainWindow.xaml.cs


示例14: Create

 private IMessage Create(Message msg)
 {
     return new FeedMessage
     {
         XmppMessage = msg,
         Date = DateTime.Now,
         ClientId = _client.Id
     };
 }
开发者ID:Irdis,项目名称:VSTalk,代码行数:9,代码来源:XmppClientMessageProvider.cs


示例15: FurikoMessage

 public FurikoMessage(Message _msg)
 {
     DateTime now = DateTime.Now;
     //time = now.ToString("yyyy-MM-dd HH:mm:ss");
     time = DateTime.Now;
     with = _msg.From.Bare;
     jid = _msg.From.Bare;
     body = _msg.Body;
 }
开发者ID:nimdraugsael,项目名称:furiko,代码行数:9,代码来源:FurikoMessage.cs


示例16: OnMessage

 public void OnMessage(object sender, Message msg)
 {
     if (msg.Type == MessageType.chat)
     {
         messages.Enqueue(msg);
         messageEvent.Set();
         //currentChat = msg.CreateNewThread();
     }
 }
开发者ID:ChrisFewtrell,项目名称:GOOS-Walkthrough,代码行数:9,代码来源:SingleMessageListener.cs


示例17: Create

 public Message Create(FlowDocument document)
 {
     var body = new TextRange(document.ContentStart, document.ContentEnd)
             .Text
             .TrimEnd(Environment.NewLine.ToCharArray());
     var msg = new Message();
     msg.Body = body;
     return msg;
 }
开发者ID:Irdis,项目名称:VSTalk,代码行数:9,代码来源:TextMessageBuilder.cs


示例18: button2_Click_1

 private void button2_Click_1(object sender, EventArgs e)
 {
     agsXMPP.protocol.client.Message msg = new agsXMPP.protocol.client.Message();
     msg.Type = MessageType.groupchat;
     msg.To = Roomjid;
     msg.Body = textBox2.Text;
     dbcon.Send(msg);
     textBox2.Clear();
 }
开发者ID:dbh4ck,项目名称:XMPP-Client-csharp-Nimbuzz-Demo,代码行数:9,代码来源:loggednimbuzz.cs


示例19: XmppConnection_OnMessage

        //Blink and add to notification list if messaged
        private void XmppConnection_OnMessage(object sender, Message msg)
        {
            //If is special message, don't show popup
            if (msg.Subject != null)
            {
                Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                {
                    var subject = (ChatSubjects)Enum.Parse(typeof(ChatSubjects), msg.Subject, true);

                    if ((subject == ChatSubjects.PRACTICE_GAME_INVITE ||
                         subject == ChatSubjects.GAME_INVITE) &&
                        Client.NotificationContainer.Visibility != Visibility.Visible)
                    {
                        NotificationButton.Content = ".";
                    }
                }));
                return;
            }

            if (!Client.AllPlayers.ContainsKey(msg.From.User) || string.IsNullOrWhiteSpace(msg.Body))
                return;
            if (msg.Body.ToLower().Contains("elo") && msg.Body.ToLower().Contains("boost"))
                return;

            ChatPlayerItem chatItem = Client.AllPlayers[msg.From.User];
            Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
            {
                NotificationChatPlayer player =
                    ChatListView.Items.Cast<object>()
                        .Where(i => i.GetType() == typeof(NotificationChatPlayer))
                        .Cast<NotificationChatPlayer>()
                        .FirstOrDefault(x => x.PlayerName == chatItem.Username);

                if (player == null)
                {
                    player = new NotificationChatPlayer
                    {
                        Tag = chatItem,
                        PlayerName = chatItem.Username,
                        Margin = new Thickness(1, 0, 1, 0),
                        PlayerLabelName = { Content = chatItem.Username }
                    };
                    Client.ChatListView.Items.Add(player);
                }

                if (Client.ChatItem != null)
                {
                    if ((string)Client.ChatItem.PlayerLabelName.Content != chatItem.Username)
                    {
                        player.BlinkRectangle.Visibility = Visibility.Visible;
                    }
                }
                else
                    player.BlinkRectangle.Visibility = Visibility.Visible;
            }));
        }
开发者ID:osiato,项目名称:LegendaryClient,代码行数:57,代码来源:StatusPage.xaml.cs


示例20: OnMessage

        private void OnMessage(object sender, Message msg)
        {
            if (m_listener == null)
            return;

             if (msg.From.Bare != Jid)
            return;

             m_listener.OnMessage(new ChatMessage(msg.From.Resource, msg.Body));
        }
开发者ID:dustyburwell,项目名称:jell,代码行数:10,代码来源:XmppChatRoom.cs



注:本文中的agsXMPP.protocol.client.Message类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# client.Presence类代码示例发布时间:2022-05-26
下一篇:
C# client.IQ类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap