ObjXMPP  Diff

Differences From Artifact [c409a8ce2b]:

To Artifact [f961d31c3a]:


18
19
20
21
22
23
24

25
26
27
28
29
30
31
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

#import "XMPPContact.h"

#import "XMPPMessage.h"
#import "XMPPConnection.h"

@implementation XMPPContact
@synthesize rosterItem = _rosterItem;
@synthesize presences = _presences;








>







18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

#import "XMPPContact.h"
#import "XMPPContact+Private.h"
#import "XMPPMessage.h"
#import "XMPPConnection.h"

@implementation XMPPContact
@synthesize rosterItem = _rosterItem;
@synthesize presences = _presences;

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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
- (void)dealloc
{
	[_presences release];

	[super dealloc];
}

- (void)sendMessage: (XMPPMessage*)message
	 connection: (XMPPConnection*)connection
{
	if (_lockedOnJID == nil)
		[message setTo: [_rosterItem JID]];
	else
		[message setTo: _lockedOnJID];

	[connection sendStanza: message];
}

- (void)XMPP_setRosterItem: (XMPPRosterItem*)rosterItem
{
	XMPPRosterItem *old = _rosterItem;
	_rosterItem = [rosterItem retain];
	[old release];
}

- (void)XMPP_setPresence: (XMPPPresence*)presence
		resource: (OFString*)resource
{
	if (resource != nil)
		[_presences setObject: presence
			       forKey: resource];
	else
		[_presences setObject: presence
			       forKey: @""];

	[self XMPP_setLockedOnJID: nil];
}

- (void)XMPP_removePresenceForResource: (OFString*)resource
{
	if (resource != nil) {
		[_presences removeObjectForKey: resource];
	} else {
		[_presences release];
		_presences = [[OFMutableDictionary alloc] init];
	}

	[self XMPP_setLockedOnJID: nil];
}

- (void)XMPP_setLockedOnJID: (XMPPJID*)JID;
{
	XMPPJID *old = _lockedOnJID;
	_lockedOnJID = [JID retain];
	[old release];
}
@end







|
|









|






|
|











|











|






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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
- (void)dealloc
{
	[_presences release];

	[super dealloc];
}

- (void)sendMessage: (XMPPMessage *)message
	 connection: (XMPPConnection *)connection
{
	if (_lockedOnJID == nil)
		[message setTo: [_rosterItem JID]];
	else
		[message setTo: _lockedOnJID];

	[connection sendStanza: message];
}

- (void)XMPP_setRosterItem: (XMPPRosterItem *)rosterItem
{
	XMPPRosterItem *old = _rosterItem;
	_rosterItem = [rosterItem retain];
	[old release];
}

- (void)XMPP_setPresence: (XMPPPresence *)presence
		resource: (OFString *)resource
{
	if (resource != nil)
		[_presences setObject: presence
			       forKey: resource];
	else
		[_presences setObject: presence
			       forKey: @""];

	[self XMPP_setLockedOnJID: nil];
}

- (void)XMPP_removePresenceForResource: (OFString *)resource
{
	if (resource != nil) {
		[_presences removeObjectForKey: resource];
	} else {
		[_presences release];
		_presences = [[OFMutableDictionary alloc] init];
	}

	[self XMPP_setLockedOnJID: nil];
}

- (void)XMPP_setLockedOnJID: (XMPPJID *)JID;
{
	XMPPJID *old = _lockedOnJID;
	_lockedOnJID = [JID retain];
	[old release];
}
@end