debug: print state names

master
Michael Santos 6 years ago
parent de9fa9ab30
commit 3f7ef5ca7b

@ -321,8 +321,8 @@ decode() {
stty cols 80 rows 24
xmppipe --resource viewer --output console --base64 | \
while IFS=: read x s f t m; do
[ "$m" = "m" ] && decode $5
while IFS=: read -r x s f t m; do
[ "$m" = "m" ] && decode "$m"
done
~~~

@ -63,6 +63,22 @@ enum {
OPT_NO_TLS_VERIFY = 1
};
static const char const *xmppipe_states[] = {
"XMPPIPE_S_DISCONNECTED",
"XMPPIPE_S_CONNECTING",
"XMPPIPE_S_CONNECTED",
"XMPPIPE_S_MUC_SERVICE_LOOKUP",
"XMPPIPE_S_MUC_FEATURE_LOOKUP",
"XMPPIPE_S_MUC_WAITJOIN",
"XMPPIPE_S_MUC_JOIN",
"XMPPIPE_S_MUC_UNLOCK",
"XMPPIPE_S_READY",
"XMPPIPE_S_READY_AVAIL",
"XMPPIPE_S_READY_EMPTY"
};
static const struct option long_options[] =
{
{"address", required_argument, NULL, 'a'},
@ -1289,7 +1305,11 @@ xmppipe_strtonum(xmppipe_state_t *state, const char *nptr, long long minval,
xmppipe_next_state(xmppipe_state_t *state, int status)
{
if (state->verbose)
(void)fprintf(stderr, "status: %d -> %d\n", state->status, status);
(void)fprintf(stderr, "next state: %s (%d) -> %s (%d)\n",
(state->status < 0 || state->status > XMPPIPE_S_READY_EMPTY) ? "unknown" : xmppipe_states[state->status],
state->status,
(state->status < 0 || state->status > XMPPIPE_S_READY_EMPTY) ? "unknown" : xmppipe_states[status],
status);
state->status = status;
}

@ -23,7 +23,7 @@
#include <strophe.h>
#define XMPPIPE_VERSION "0.9.3"
#define XMPPIPE_VERSION "0.10.0"
#define XMPPIPE_RESOURCE "xmppipe"
#define XMPPIPE_STREQ(a,b) (strcmp((a),(b)) == 0)

Loading…
Cancel
Save