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