Not logged in. · Lost password · Register
Forum: agsXMPP SDK Support RSS
Avatar
mayprog #1
Member since Mar 2006 · 61 posts
Group memberships: Members
Show profile · Link to this post
Subject: SubscriptionType problem
I found the following
    public enum SubscriptionType
    {
        none,
        to,
        from,
        both,
        remove
    }
althought i am not sure about this, what is the SubscriptionType when there is not such a field in the RosterItem element?
I suppose this should be none?
I changed the code to:
    public enum SubscriptionType
    {
        none=-1,
        to,
        from,
        both,
        remove
    }
to work normally.
This type came to me from the Wildfire server when he send me the "welcome " messages uppon a new acount creation.
Is this the way to handle that situation or not?

Thanks !
Avatar
Alex #2
Member since Feb 2003 · 4245 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Hello mayprog,

not sure if the subscription is optional. I will take a look again at the XMPP RFC's. But in case a server does not send this attribute for some reason none = -1 would help here.

Alex
Alexander Gnauck
AG-Software
Avatar
Alex #3
Member since Feb 2003 · 4245 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
OK, according to the XML schema the subscription attribute is optional. But i have not seen a rosterItem without this attribute yet. I added the -1 to none. Its also time to to a SVN update. I think i will do that tomorrow.

Alex
Alexander Gnauck
AG-Software
Avatar
mayprog #4
Member since Mar 2006 · 61 posts
Group memberships: Members
Show profile · Link to this post
Well its ok with that,
but this problem raised because of a fault of mine.
When a message comes to my app I have to match it with a valid RosterItem, so,
when wildfire sends me a message where there is not a "server" RosterItem in my list, I created a
new RosterItem(msg.From)
which was the only way to handle this.
That of course gave me a non subscription value and a non user jid.....
In any case, as this is optional its better to have the -1 value i think.

Thanks!
Avatar
Alex #5
Member since Feb 2003 · 4245 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
i looked closer at this again and i don't think we should use none = -1. The problem here is id we set this to default and we receive a rosterItem like this:

  1. <item jid="test@jabber.org" name="test"/>

And read this rosterItem the type will be none. When we write the xml of this object then it will be

  1. <item jid="test@jabber.org" name="test" subscription="none" />

to be 100% correct we need another enum Member for a non existing subscription tag. In the most other enums this is NONE with all capital characters. If i add such a type i assume Visual Basic developers will be in trouble because it's not case sensitive.
Any suggestions?

Alex
Alexander Gnauck
AG-Software
Avatar
mayprog #6
Member since Mar 2006 · 61 posts
Group memberships: Members
Show profile · Link to this post
You are 100% right.
The "none" keyword, wherever you use it means "the value is none", where in our case we want to say "there in not any value".
So, i think, you are right by implenting this way the "none" in the subscription tag, as "none" means there isn't any presence notification from one to another.
On the other hand when the subscription is missing it doesn't mean the same, in that case it has the meaning "i don't know".

I agree with you to add an extra enum value.This could be the "missing" one, having the -1 value.
If you are to "set" just remove it from the tag as you do with eg AskType, if you are to "get" everything is ok.

What do you think?
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 SDK Support RSS