當前位置: 首頁>>代碼示例>>C#>>正文


C# client.Message類代碼示例

本文整理匯總了C#中agsXMPP.protocol.client.Message的典型用法代碼示例。如果您正苦於以下問題:C# Message類的具體用法?C# Message怎麽用?C# Message使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Message類屬於agsXMPP.protocol.client命名空間,在下文中一共展示了Message類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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


注:本文中的agsXMPP.protocol.client.Message類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。