【问题标题】:Get the unavailable status of an xmpp contact获取 xmpp 联系人的不可用状态
【发布时间】:2014-02-17 09:28:18
【问题描述】:

我正在使用 Jabber-Net 库制作一个 Windows 聊天客户端。 当用户退出时,我使用此代码设置不可用状态...以便人们可以看到他们的离线状态。它在 Spark 等 XMPP 客户端中可见。但我无法获得其他联系人的状态。设置此状态.... 我怎么才能得到它。请帮忙!!...

     jabberClient1.Presence(jabber.protocol.client.PresenceType.unavailable, ApplicationVariables.chatstatus, ApplicationVariables.chatpresence, 0);

【问题讨论】:

    标签: c# xmpp


    【解决方案1】:

    我自己找到了它......我很乐意分享它。让它对想要这个的人有用..

    public void RequestLastMessage(JID jabberid)
    {
        try
        {
            LastIQ iq = new LastIQ(jabberClient1.Document);
            iq.To = jabberid;
    
            iq.Type = jabber.protocol.client.IQType.get;
            jabberClient1.Tracker.BeginIQ(iq, LastMessage, null);
        }
        catch (Exception ex)
        {
            DebugLogger.LogRecord(ex.Message + " [ Function: " + System.Reflection.MethodBase.GetCurrentMethod().Name + " Class: XMPPWrapper ]");
        }
    }
    
    private void LastMessage(object sender, jabber.protocol.client.IQ iq, object state)
    {
        try
        {
            if ((iq == null) || (iq.Type != jabber.protocol.client.IQType.result))
                return;
            Last ll = iq.Query as Last;
            if (iq.From != null && ll.Message != "")
                if (ApplicationVariables.GlobalContactForm != null) ApplicationVariables.GlobalContactForm.SetOfflineStatus(ll.Message, iq.From);
        }
        catch (Exception ex)
        {
            DebugLogger.LogRecord(ex.Message + " [ Function: " + System.Reflection.MethodBase.GetCurrentMethod().Name + " Class: XMPPWrapper ]");
        }
    
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-05-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-12-27
      • 1970-01-01
      相关资源
      最近更新 更多