20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <assert.h>
#import <ObjFW/ObjFW.h>
#import "XMPPConnection.h"
#import "XMPPJID.h"
#import "XMPPStanza.h"
#import "XMPPIQ.h"
#import "XMPPMessage.h"
#import "XMPPPresence.h"
|
>
|
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <assert.h>
#import <ObjFW/ObjFW.h>
#import <ObjOpenSSL/SSLInvalidCertificateException.h>
#import "XMPPConnection.h"
#import "XMPPJID.h"
#import "XMPPStanza.h"
#import "XMPPIQ.h"
#import "XMPPMessage.h"
#import "XMPPPresence.h"
|
131
132
133
134
135
136
137
138
139
140
141
142
143
144
|
pres = [XMPPPresence presence];
[pres addPriority: 10];
[pres addStatus: @"ObjXMPP test is working!"];
[conn sendStanza: pres];
}
- (void)connection: (XMPPConnection*)conn
didReceiveRosterItem: (XMPPRosterItem*)rosterItem
{
of_log(@"Got roster push: %@", rosterItem);
}
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
|
pres = [XMPPPresence presence];
[pres addPriority: 10];
[pres addStatus: @"ObjXMPP test is working!"];
[conn sendStanza: pres];
}
- (void)connectionDidUpgradeToTLS: (XMPPConnection*)conn
{
@try {
[conn checkCertificate];
} @catch (SSLInvalidCertificateException *e) {
OFString *answer;
[of_stdout writeString: @"Couldn't verify certificate: "];
[of_stdout writeFormat: @"%@\n", e];
[of_stdout writeString: @"Do you want to continue [y/N]? "];
answer = [of_stdin readLine];
if (![answer hasPrefix: @"y"])
@throw e;
}
}
- (void)connection: (XMPPConnection*)conn
didReceiveRosterItem: (XMPPRosterItem*)rosterItem
{
of_log(@"Got roster push: %@", rosterItem);
}
|