diff --git a/src/muc.c b/src/muc.c index 2e05517..bc6d2e0 100644 --- a/src/muc.c +++ b/src/muc.c @@ -33,7 +33,7 @@ void xmppipe_muc_join(xmppipe_state_t *state) { (void)xmpp_stanza_release(presence); } -void xmppipe_muc_subject(xmppipe_state_t *state, char *buf) { +void xmppipe_muc_subject(xmppipe_state_t *state, const char *buf) { xmpp_stanza_t *message; xmpp_stanza_t *subject; xmpp_stanza_t *text; diff --git a/src/xmppipe.h b/src/xmppipe.h index fa6d48d..b02a2c8 100644 --- a/src/xmppipe.h +++ b/src/xmppipe.h @@ -124,10 +124,10 @@ int handle_iq(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); void xmppipe_muc_join(xmppipe_state_t *); -void xmppipe_muc_subject(xmppipe_state_t *, char *); +void xmppipe_muc_subject(xmppipe_state_t *, const char *); void xmppipe_muc_unlock(xmppipe_state_t *); -void xmppipe_send_stanza(xmppipe_state_t *, char *, size_t); +void xmppipe_send_stanza(xmppipe_state_t *, const char *, size_t); void xmppipe_send(xmppipe_state_t *, xmpp_stanza_t *const); int xmppipe_fmt_init(void); diff --git a/src/xmppipe_send.c b/src/xmppipe_send.c index d74e210..098d1f4 100644 --- a/src/xmppipe_send.c +++ b/src/xmppipe_send.c @@ -14,19 +14,19 @@ */ #include "xmppipe.h" -static void xmppipe_send_stanza_fmt(xmppipe_state_t *state, char *buf, +static void xmppipe_send_stanza_fmt(xmppipe_state_t *state, const char *buf, size_t len); -static void xmppipe_send_message(xmppipe_state_t *state, char *to, char *type, - char *buf, size_t len); +static void xmppipe_send_message(xmppipe_state_t *state, const char *to, + const char *type, const char *buf, size_t len); -static void xmppipe_send_oob(xmppipe_state_t *state, char *to, char *type, - char *buf, size_t len); +static void xmppipe_send_oob(xmppipe_state_t *state, const char *to, + const char *type, const char *buf, size_t len); -static void xmppipe_send_http_upload(xmppipe_state_t *state, char *to, - char *type, char *buf, size_t len); +static void xmppipe_send_http_upload(xmppipe_state_t *state, const char *to, + const char *type, char *buf, size_t len); -void xmppipe_send_stanza(xmppipe_state_t *state, char *buf, size_t len) { +void xmppipe_send_stanza(xmppipe_state_t *state, const char *buf, size_t len) { switch (state->format) { case XMPPIPE_FMT_TEXT: xmppipe_send_message( @@ -46,7 +46,7 @@ void xmppipe_send_stanza(xmppipe_state_t *state, char *buf, size_t len) { } } -static void xmppipe_send_stanza_fmt(xmppipe_state_t *state, char *buf, +static void xmppipe_send_stanza_fmt(xmppipe_state_t *state, const char *buf, size_t len) { char *to = NULL; char *type = NULL; @@ -162,8 +162,9 @@ XMPPIPE_DONE: free(body); } -static void xmppipe_send_message(xmppipe_state_t *state, char *to, char *type, - char *buf, size_t len) { +static void xmppipe_send_message(xmppipe_state_t *state, const char *to, + const char *type, const char *buf, + size_t len) { xmpp_stanza_t *message; char *id; @@ -172,7 +173,7 @@ static void xmppipe_send_message(xmppipe_state_t *state, char *to, char *type, message = xmppipe_message_new(state->ctx, type, to, id); if (state->encode) { - char *b64 = xmpp_base64_encode(state->ctx, (unsigned char *)buf, len); + char *b64 = xmpp_base64_encode(state->ctx, (const unsigned char *)buf, len); if (b64 == NULL) errx(EXIT_FAILURE, "encode: invalid input: %zu", len); @@ -187,8 +188,8 @@ static void xmppipe_send_message(xmppipe_state_t *state, char *to, char *type, xmpp_free(state->ctx, id); } -static void xmppipe_send_oob(xmppipe_state_t *state, char *to, char *type, - char *buf, size_t len) { +static void xmppipe_send_oob(xmppipe_state_t *state, const char *to, + const char *type, const char *buf, size_t len) { xmpp_stanza_t *message; xmpp_stanza_t *x; xmpp_stanza_t *url; @@ -223,8 +224,8 @@ static void xmppipe_send_oob(xmppipe_state_t *state, char *to, char *type, xmpp_free(state->ctx, id); } -static void xmppipe_send_http_upload(xmppipe_state_t *state, char *to, - char *type, char *buf, size_t len) { +static void xmppipe_send_http_upload(xmppipe_state_t *state, const char *to, + const char *type, char *buf, size_t len) { xmpp_stanza_t *iq; xmpp_stanza_t *request; char *id;