Not logged in. · Lost password · Register
Forum: agsXMPP RSS
Avatar
irokhes #1
Member since Mar 2012 · 16 posts
Group memberships: Members
Show profile · Link to this post
Subject: Get Last Activity
Hi,

I would to know how to get last activity of a user from matrix library?

thanks!!
Avatar
Alex #2
Member since Feb 2003 · 4307 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Send a LastIq to the Jid you want the last activity from.

Alex
Avatar
irokhes #3
Member since Mar 2012 · 16 posts
Group memberships: Members
Show profile · Link to this post
Hi,

I´m trying to do this:

XmppClientConnection xmpp = new XmppClientConnection("qprocxmpp");
xmpp.Open("pepe", "pepe");
xmpp.OnLogin += new ObjectHandler(xmpp_OnLogin);


then

static void xmpp_OnLogin(object sender)
        {
            try
            {
                XmppClientConnection xmpp2 = (XmppClientConnection)sender;
                var lastIq = new agsXMPP.protocol.iq.last.LastIq(agsXMPP.protocol.client.IqType.get, "user3@qprocxmpp");
                agsXMPP.protocol.client.IQ result = xmpp2.IqGrabber.SendIq(lastIq);
                if (result != null)
                {

                }
            }
            catch (Exception ex)
            {

                Console.WriteLine(ex.Message);
            }
           
        }


But result is always null. is the code correct?

Thanks!!
Avatar
Alex #4
Member since Feb 2003 · 4307 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
yes this code is correct. Please post your Xml log. I guess that the OnLogin event it to early for your server. Try to wait until you get the first OnPresence event or use the OnRosterEnd event.

Alex
Avatar
irokhes #5
Member since Mar 2012 · 16 posts
Group memberships: Members
Show profile · Link to this post
Sorry for my ignorance but, how can i get the xml log. I don´t know how catch send and receive xml messages. Could you explain it?

Another question. How can I send a message (IQ) to block a user?

thank you so much.
Avatar
Alex #6
Member since Feb 2003 · 4307 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
There are event handlers for OnReadXml and OnWriteXml. See also the MiniClient example.
Avatar
irokhes #7
Member since Mar 2012 · 16 posts
Group memberships: Members
Show profile · Link to this post
Ok, i´m going to review miniClient. In this case i´m trying to get last activity without getting presence messages. is it possible?
Could you give me some advices for blocking users from agsXMPP library?.

Thanks.
Avatar
Alex #8
Member since Feb 2003 · 4307 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Quote by irokhes:
Ok, i´m going to review miniClient. In this case i´m trying to get last activity without getting presence messages. is it possible?
you don't need the presence because you send it to a bare Jid. YOu can also send it to online clients, then the client responds with its last activity.

See: XEP-0012: Last Activity
Or do you mean some totally different with last activity?

Quote by irokhes:
Could you give me some advices for blocking users from agsXMPP library?.
Please open another thread for this. But first use the forums search because this was discussed here several times before (privacy lists).

Alex
Avatar
irokhes #9
Member since Mar 2012 · 16 posts
Group memberships: Members
Show profile · Link to this post
Hi,

is there any possible to request last activity from user who is not in your contact list? I can get last activity from users in my contact list but i need get activity from other users.

Thanks.
Avatar
Alex #10
Member since Feb 2003 · 4307 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
This depends on the server software you are using and its configuration.
In my opinion its correct that your server reports the last activity only to subscribed users.
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Forum: agsXMPP RSS