- fprintf(stderr, "DEBUG: connected\n");
- secured = xmpp_conn_is_secured(conn);
- fprintf(stderr, "DEBUG: connection is %s.\n",
- secured ? "secured" : "NOT secured");
-
- /* create iq stanza for request */
- iq = xmpp_stanza_new(ctx);
- xmpp_stanza_set_name(iq, "iq");
- xmpp_stanza_set_type(iq, "get");
- xmpp_stanza_set_id(iq, "roster1");
-
- query = xmpp_stanza_new(ctx);
- xmpp_stanza_set_name(query, "query");
- xmpp_stanza_set_ns(query, XMPP_NS_ROSTER);
-
- xmpp_stanza_add_child(iq, query);
-
- /* we can release the stanza since it belongs to iq now */
- xmpp_stanza_release(query);
-
- /* set up reply handler */
- xmpp_id_handler_add(conn, handle_reply, "roster1", ctx);
-
- /* send out the stanza */
- xmpp_send(conn, iq);
-
- /* release the stanza */
- xmpp_stanza_release(iq);
+ xmpp_handler_add(Conn, onreceive, NULL, "message", NULL, Ctx);
+ /* Anounce presence */
+ xmpp_stanza_t* pres = xmpp_stanza_new(Ctx);
+ xmpp_stanza_set_name(pres, "presence");
+ xmpp_send(Conn, pres);
+ xmpp_stanza_release(pres);