summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWill Thompson <will.thompson@collabora.co.uk>2013-02-22 10:29:30 +0000
committerWill Thompson <will.thompson@collabora.co.uk>2013-02-22 10:29:30 +0000
commit883cd456c08964d01d323a6cfc1590ce858ea653 (patch)
tree30997d795fc72c3c77e75e4d2f536b6e5e62dfd6
parent5fb069a253550389704912c8c11e5291b72ee168 (diff)
receive-messages example: add a --resource parameter
-rw-r--r--examples/receive-messages.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/examples/receive-messages.c b/examples/receive-messages.c
index 79da409..1d6e392 100644
--- a/examples/receive-messages.c
+++ b/examples/receive-messages.c
@@ -3,7 +3,6 @@
#endif
#include <stdio.h>
-#include <stdlib.h>
#include <string.h>
@@ -167,12 +166,16 @@ connected_cb (
}
static gboolean ignore_ssl_errors = FALSE;
+static gchar *resource = NULL;
static GOptionEntry entries[] =
{
{ "ignore-ssl-errors", 0, 0, G_OPTION_ARG_NONE, &ignore_ssl_errors,
"Continue connecting, even if the server provides an invalid SSL certificate",
NULL },
+ { "resource", 'r', 0, G_OPTION_ARG_STRING, &resource,
+ "Connect as a specific resource (default: let the server decide)",
+ "RESOURCE" },
{ NULL }
};
@@ -208,7 +211,7 @@ main (int argc,
tls_handler = wocky_tls_handler_new (TRUE);
mainloop = g_main_loop_new (NULL, FALSE);
- connector = wocky_connector_new (jid, password, NULL, NULL, tls_handler);
+ connector = wocky_connector_new (jid, password, resource, NULL, tls_handler);
wocky_connector_connect_async (connector, NULL, connected_cb, NULL);
g_main_loop_run (mainloop);