XML_Parser expat;
xmpp_state_t state;
buf_t buf;
+ buf_t html;
int level;
int id;
xmpp_channel_t *msg_chan;
xmpp_user_t *msg_usr;
char *msg_body;
+ char *msg_html;
stamp_t msg_stamp;
+ int in_html;
int in_error;
} xmpp_server_t;
xmpp_channel_t *chan = (xmpp_channel_t *)cur;
if (!chan->join)
continue;
- chan_notice(chan, "XMPP Channel: %s", chan->channel.name);
+ if (!srv->quiet)
+ chan_notice(chan, "XMPP Channel: %s", chan->channel.name);
net_print(&srv->net,
"<presence id='join' from='%s' to='%s/%s'>"
"<x xmlns='http://jabber.org/protocol/muc'/>"
if (match(end, "body") && data) {
strset(&srv->msg_body, data);
}
+ if (match(start, "html")) {
+ srv->in_html = 1;
+ }
+ if (srv->in_html && data) {
+ append(&srv->html, data, strlen(data));
+ }
+ if (match(end, "html")) {
+ strset(&srv->msg_html, reset(&srv->html));
+ srv->in_html = 0;
+ }
if (match(end, "message")) {
debug("xmpp: body (%s) -- chan=[%s] from=[%s]",
chan->type,
chan->channel.name,
usr ? usr->user.name : "(none)");
- if (srv->msg_body) {
- chat_recv(&chan->channel,
- &usr->user,
- srv->msg_body);
+ char *content = srv->msg_body;
+ if (srv->msg_html)
+ content = despace(srv->msg_html);
+ if (content) {
+ chat_recv(&chan->channel, &usr->user, content);
message_t *msg = &messages[history-1];
msg->when = srv->msg_stamp ?: msg->when;
}
srv->msg_stamp = 0;
strset(&srv->msg_body, NULL);
+ strset(&srv->msg_html, NULL);
}
+
}
/* Presence */
srv->myself.user.server = &srv->server;
srv->myself.user.name = strcopy(srv->nick);
- if (srv->connect) {
+ if (srv->connect && !srv->quiet)
srv_notice(srv, "XMPP Server: %s", srv->server.name);
+ if (srv->connect)
xmpp_run(srv, 0, NULL, NULL, NULL, NULL);
- }
}
for (channel_t *cur = channels; cur; cur = cur->next) {
if (cur->server->protocol != XMPP)