XMPPRegistration.h
3.13 KB
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
87
88
89
90
91
92
93
94
//
// Created by Jonathon Staff on 10/11/14.
// Copyright (c) 2014 Jonathon Staff. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "XMPPModule.h"
@class XMPPIDTracker;
#define _XMPP_REGISTRATION_H
@interface XMPPRegistration : XMPPModule {
XMPPIDTracker *xmppIDTracker;
}
/**
* This method will attempt to change the current user's password to the new one provided. The
* user *MUST* be authenticated for this to work successfully.
*
* @see passwordChangeSuccessful:
* @see passwordChangeFailed:withError:
*
* @param newPassword The new password for the user
*/
- (BOOL)changePassword:(NSString *)newPassword;
/**
* This method will attempt to cancel the current user's registration. Later implementations
* will provide support for handling authentication challenges by the server. For now,
* simply pass a value of 'nil' in for password, or preferably, use the other cancellation
* method.
*
* @see cancelRegistration
*/
- (BOOL)cancelRegistrationUsingPassword:(NSString *)password;
/**
* This method will attempt to cancel the current user's registration. The user *MUST* be
* already authenticated for this to work successfully.
*
* @see cancelRegistrationSuccessful:
* @see cancelRegistrationFailed:withError:
*/
- (BOOL)cancelRegistration;
@end
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#pragma mark - XMPPRegistrationDelegate
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@protocol XMPPRegistrationDelegate
@optional
/**
* Implement this method when calling [regInstance changePassword:]. It will be invoked
* if the request for changing the user's password is successfully executed and receives a
* successful response.
*
* @param sender XMPPRegistration object invoking this delegate method.
*/
- (void)passwordChangeSuccessful:(XMPPRegistration *)sender;
/**
* Implement this method when calling [regInstance changePassword:]. It will be invoked
* if the request for changing the user's password is unsuccessfully executed or receives
* an unsuccessful response.
*
* @param sender XMPPRegistration object invoking this delegate method.
* @param error NSError containing more details of the failure.
*/
- (void)passwordChangeFailed:(XMPPRegistration *)sender withError:(NSError *)error;
/**
* Implement this method when calling [regInstance cancelRegistration] or a variation. It
* is invoked if the request for canceling the user's registration is successfully
* executed and receives a successful response.
*
* @param sender XMPPRegistration object invoking this delegate method.
*/
- (void)cancelRegistrationSuccessful:(XMPPRegistration *)sender;
/**
* Implement this method when calling [regInstance cancelRegistration] or a variation. It
* is invoked if the request for canceling the user's registration is unsuccessfully
* executed or receives an unsuccessful response.
*
* @param sender XMPPRegistration object invoking this delegate method.
* @param error NSError containing more details of the failure.
*/
- (void)cancelRegistrationFailed:(XMPPRegistration *)sender withError:(NSError *)error;
@end