Not logged in. · Lost password · Register
Forum: MatriX and XmppDotNet RSS
Avatar
martinbach #1
Member since Mar 2009 · 60 posts
Group memberships: Members
Show profile · Link to this post
Subject: How to update my roster listview control using Matrix.Xmpp.Roster.RosterEventArgs
Hi Alex,

I try to update my roster listview control using RosterEventArgs:

...
xmppClient.OnRosterItem += new EventHandler<Matrix.Xmpp.Roster.RosterEventArgs>(xmppClient_OnRosterItem);
...
void xmppClient_OnRosterItem(object sender, Matrix.Xmpp.Roster.RosterEventArgs e)
{
       ...
       if (e.RosterItem.Subscription != Subscription.remove )
       {
    ...
       }
      
       [b]if ( e.RosterItem.???? != ?????.add)[/b]
       {
    ...
       }
       ...
}

I can't find another property than "e.RosterItem.Subscription" but I need something to ask if an item was added, removed or else.
What I have to do to know if an RosterItem was added, removed or something else.

Thank you for your help.

Martin
Avatar
Alex #2
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
you only have to check for Subscription.remove. All other cases are new contacts or updated contacts.
If it is a new contact or updated contact you can detect with your listview. Check if an item with the same Jid already exists.
Let me know if this helps or if you have more questions.

Alex
Avatar
martinbach #3
Member since Mar 2009 · 60 posts
Group memberships: Members
Show profile · Link to this post
Hi Alex,

the way I tried is is correct then.

Adding (just add) is ok,
Updating (remove if contact is in list + add) is ok

How do I decide in case of just removing from roster? (It's not Subscription.Remove or do I think the wrong way)

Martin
Avatar
Alex #4
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
  1. if (e.RosterItem.Subscription == Subscription.remove )
  2. {
  3.    // remove the rosteritem
  4. }
  5. else
  6. {
  7.    // add or update the rosteritem
  8. }

Alex
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: