blob: ce5ecc50e975a25d255038e957a7a80901f56bf5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
/*
* Copyright (c) 2010-2015, Isode Limited, London, England.
* All rights reserved.
*/
package com.isode.stroke.roster;
import java.util.Set;
import java.util.Collection;
import com.isode.stroke.elements.RosterItemPayload;
import com.isode.stroke.jid.JID;
import com.isode.stroke.signals.Signal;
import com.isode.stroke.signals.Signal1;
import com.isode.stroke.signals.Signal3;
/**
* This class represents the roster of an account, as stored on the XMPP server.
*
* Changes to the roster (either due to subscription requests or by going online/offline) are
* emitted through signals.
*/
public abstract class XMPPRoster {
/**
* Checks whether the bare jid of the given jid is in the roster.
*/
public abstract boolean containsJID(final JID jid);
/**
* Retrieves the subscription state for the given jid.
*/
public abstract RosterItemPayload.Subscription getSubscriptionStateForJID(final JID jid);
/**
* Retrieves the stored roster name for the given jid.
*/
public abstract String getNameForJID(final JID jid);
/**
* Returns the list of groups for the given JID.
*/
public abstract Collection<String> getGroupsForJID(final JID jid);
/**
* Retrieve the items in the roster.
*/
public abstract Collection<XMPPRosterItem> getItems();
/**
* Retrieve the item with the given JID.
*/
public abstract XMPPRosterItem getItem(final JID jid);
/**
* Retrieve the list of (existing) groups.
*/
public abstract Set<String> getGroups();
/**
* Emitted when the given JID is added to the roster.
*/
public final Signal1<JID> onJIDAdded = new Signal1<JID>();
/**
* Emitted when the given JID is removed from the roster.
*/
public final Signal1<JID> onJIDRemoved = new Signal1<JID>();
/**
* Emitted when the name or the groups of the roster item with the
* given JID changes.
*/
public final Signal3<JID, String, Collection<String>> onJIDUpdated = new Signal3<JID, String, Collection<String>>();
/**
* Emitted when the roster is reset (e.g. due to logging in/logging out).
* After this signal is emitted, the roster is empty. It will be repopulated through
* onJIDAdded and onJIDRemoved events.
*/
public final Signal onRosterCleared = new Signal();
/**
* Emitted after the last contact of the initial roster request response
* was added.
*/
public final Signal onInitialRosterPopulated = new Signal();
}
|