Пример #1
0
        //消息处理
        void objXmpp_OnMessage(object sender, agsXMPP.protocol.client.Message msg)
        {
            string strMsg = null;

            //G_Status("ReciveMsg", "【接收消息】 From:" + msg.From.Bare + " Msg:" + msg.Body);

            if (SystemCommand(msg.Body))
            {
                string[] arrCmd = msg.Body.Split(' ');
                if (arrCmd[0].ToLower() == "status")
                {
                    switch (arrCmd[1].ToLower())
                    {
                    case "online":
                        objXmpp.Show = ShowType.NONE;
                        objXmpp.SendMyPresence();
                        G_Status("", "【状态改变】在线");
                        strMsg = "【状态改变】在线";
                        break;

                    case "away":
                        objXmpp.Show = ShowType.away;
                        objXmpp.SendMyPresence();
                        G_Status("", "【状态改变】闲置");
                        strMsg = "【状态改变】闲置";
                        break;

                    case "busy":
                        objXmpp.Show = ShowType.dnd;
                        objXmpp.SendMyPresence();
                        G_Status("", "【状态改变】忙碌");
                        strMsg = "【状态改变】忙碌";
                        break;

                    case "cpu":
                        strMsg = SIC._CPU;
                        break;

                    case "disk":
                        strMsg = SIC.DiskInfo();
                        break;

                    case "file":
                        FileTransfer FT = new FileTransfer(objXmpp, new Jid("*****@*****.**"));
                        break;
                    }
                }
                //agsXMPP.Jid jid = new agsXMPP.Jid(msg.From.Bare);
                //Message autoReply = new Message(jid, MessageType.chat, strMsg);
                //objXmpp.Send(autoReply);
                //G_Status("SendMsg", "【发送消息】 To:" + msg.From.Bare + " Msg:" + autoReply.Body);
            }
            else
            {
                //strMsg = msg.Body;
                //agsXMPP.Jid jid = new agsXMPP.Jid(msg.From.Bare);
                //Message autoReply = new Message(jid, MessageType.chat, strMsg);
                //objXmpp.Send(autoReply);
                //G_Status("SendMsg", "【发送消息】 To:" + msg.From.Bare + " Msg:" + autoReply.Body);
            }
        }