Merge pull request #15 from flosse/extend-basic-example

added host parameter; replaced tabs with whitespace
This commit is contained in:
Jack Moffitt
2012-02-15 20:33:38 -08:00

View File

@@ -39,16 +39,20 @@ int main(int argc, char **argv)
xmpp_ctx_t *ctx;
xmpp_conn_t *conn;
xmpp_log_t *log;
char *jid, *pass;
char *jid, *pass, *host;
/* take a jid and password on the command line */
if (argc != 3) {
fprintf(stderr, "Usage: basic <jid> <pass>\n\n");
if (argc < 3 || argc > 4) {
fprintf(stderr, "Usage: basic <jid> <pass> [<host>]\n\n");
return 1;
}
jid = argv[1];
pass = argv[2];
host = NULL;
if (argc == 4)
host = argv[3];
/* init library */
xmpp_initialize();
@@ -65,7 +69,7 @@ int main(int argc, char **argv)
xmpp_conn_set_pass(conn, pass);
/* initiate connection */
xmpp_connect_client(conn, NULL, 0, conn_handler, ctx);
xmpp_connect_client(conn, host, 0, conn_handler, ctx);
/* enter the event loop -
our connect handler will trigger an exit */