Not logged in. · Lost password · Register
Forum: agsXMPP RSS
Avatar
Cojito123 #1
Member since Jul 2009 · 3 posts
Group memberships: Members
Show profile · Link to this post
thanks a lot that helped!
But i have more ;)

is there a way to extend the Presence?
The server i querying is sending a custom attribute  called userdata in their presence which i want to read.
My attempts so far where trying to derive from presence and add an attribute called userdata to it like this:
using agsXMPP.protocol.Base;
using agsXMPP.protocol.extensions.nickname;
using agsXMPP.protocol.x;
using agsXMPP.protocol.x.muc;
using System;

namespace ConsoleClient
{
    public class Presence : agsXMPP.protocol.client.Presence
    {
        public string user_data;
        public string UserData
        {
            get { return GetTag("user_data"); }
            set { SetTag("user_data", value.ToString()); }
        }
    }
}

Saidly though this can not be user with the Onpresence event :(

Is there an interface i could derive from?
Avatar
Alex #2
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
yes, what you are doing is correct. You are only missing one part.
You have to register your derived Presence class in the ElementFactory. This will override the Presence class you derived from. In the OnPresence callback the packets should be all of your new type then.

Register your new Presence class with the following code:

  1. AddElementType("presence", Uri.CLIENT, typeof(MyPresence));
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