#include <string.h>
#include "tcp_connect.h"
#include "iksemel_extra.h"
+#include "xmpp.h"
int
myhook (void *data, int type, iks *stanza)
{
- char *s = iks_string (iks_stack (stanza), stanza);
- write (1, s, strlen (s));
+ if (!iks_strcmp (iks_name (stanza), "stream:features"))
+ {
+ hc_xmpp_features (data, stanza);
+ if (hc_xmpp_is_tls_supported (data))
+ fprintf (stderr, "TLS is supported\n");
+ if (hc_xmpp_is_sasl_supported (data))
+ fprintf (stderr, "SASL is supported\n");
+ }
+ else
+ {
+ fprintf (stderr, "Other: %s\n", iks_string (iks_stack (stanza), stanza));
+ }
return IKS_OK;
}
char *server = "jabber-br.org";
int fd;
iksparser *parser;
+ hc_xmpp_t *xmpp;
dns_init (NULL, 1);
+ xmpp = hc_xmpp_new ();
fd = hc_tcp_connect (server, "xmpp-client");
- parser = iks_extra_stream_new (NULL, myhook);
+ parser = iks_extra_stream_new (xmpp, myhook);
write_stream (fd, server);
loop (parser, fd);
return 0;