Implement XEP-0363: HTTP File Upload

This commit is contained in:
Dominik Heidler
2016-04-11 20:13:18 +02:00
parent 28e260c7da
commit 1b0ce852bb
24 changed files with 954 additions and 29 deletions

View File

@@ -106,7 +106,7 @@ cl_ev_presence_send(const resource_presence_t presence_type, const char *const m
}
void
cl_ev_send_msg(ProfChatWin *chatwin, const char *const msg)
cl_ev_send_msg(ProfChatWin *chatwin, const char *const msg, const char *const oob_url)
{
chat_state_active(chatwin->state);
char *plugin_msg = plugins_pre_chat_message_send(chatwin->barejid, msg);
@@ -122,7 +122,7 @@ cl_ev_send_msg(ProfChatWin *chatwin, const char *const msg)
} else {
gboolean handled = otr_on_message_send(chatwin, plugin_msg);
if (!handled) {
char *id = message_send_chat(chatwin->barejid, plugin_msg);
char *id = message_send_chat(chatwin->barejid, plugin_msg, oob_url);
chat_log_msg_out(chatwin->barejid, plugin_msg);
chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_PLAIN);
free(id);
@@ -140,7 +140,7 @@ cl_ev_send_msg(ProfChatWin *chatwin, const char *const msg)
#ifndef HAVE_LIBGPGME
gboolean handled = otr_on_message_send(chatwin, plugin_msg);
if (!handled) {
char *id = message_send_chat(chatwin->barejid, plugin_msg);
char *id = message_send_chat(chatwin->barejid, plugin_msg, oob_url);
chat_log_msg_out(chatwin->barejid, plugin_msg);
chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_PLAIN);
free(id);
@@ -161,7 +161,7 @@ cl_ev_send_msg(ProfChatWin *chatwin, const char *const msg)
chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_PGP);
free(id);
} else {
char *id = message_send_chat(chatwin->barejid, plugin_msg);
char *id = message_send_chat(chatwin->barejid, plugin_msg, oob_url);
chat_log_msg_out(chatwin->barejid, plugin_msg);
chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_PLAIN);
free(id);
@@ -176,7 +176,7 @@ cl_ev_send_msg(ProfChatWin *chatwin, const char *const msg)
// OTR unsupported, PGP unsupported
#ifndef HAVE_LIBOTR
#ifndef HAVE_LIBGPGME
char *id = message_send_chat(chatwin->barejid, plugin_msg);
char *id = message_send_chat(chatwin->barejid, plugin_msg, oob_url);
chat_log_msg_out(chatwin->barejid, plugin_msg);
chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_PLAIN);
free(id);
@@ -189,18 +189,18 @@ cl_ev_send_msg(ProfChatWin *chatwin, const char *const msg)
}
void
cl_ev_send_muc_msg(ProfMucWin *mucwin, const char *const msg)
cl_ev_send_muc_msg(ProfMucWin *mucwin, const char *const msg, const char *const oob_url)
{
char *plugin_msg = plugins_pre_room_message_send(mucwin->roomjid, msg);
message_send_groupchat(mucwin->roomjid, plugin_msg);
message_send_groupchat(mucwin->roomjid, plugin_msg, oob_url);
plugins_post_room_message_send(mucwin->roomjid, plugin_msg);
free(plugin_msg);
}
void
cl_ev_send_priv_msg(ProfPrivateWin *privwin, const char *const msg)
cl_ev_send_priv_msg(ProfPrivateWin *privwin, const char *const msg, const char *const oob_url)
{
if (privwin->occupant_offline) {
privwin_message_occupant_offline(privwin);
@@ -209,7 +209,7 @@ cl_ev_send_priv_msg(ProfPrivateWin *privwin, const char *const msg)
} else {
char *plugin_msg = plugins_pre_priv_message_send(privwin->fulljid, msg);
message_send_private(privwin->fulljid, plugin_msg);
message_send_private(privwin->fulljid, plugin_msg, oob_url);
privwin_outgoing_msg(privwin, plugin_msg);
plugins_post_priv_message_send(privwin->fulljid, plugin_msg);

View File

@@ -42,8 +42,8 @@ void cl_ev_disconnect(void);
void cl_ev_presence_send(const resource_presence_t presence_type, const char *const msg, const int idle_secs);
void cl_ev_send_msg(ProfChatWin *chatwin, const char *const msg);
void cl_ev_send_muc_msg(ProfMucWin *mucwin, const char *const msg);
void cl_ev_send_priv_msg(ProfPrivateWin *privwin, const char *const msg);
void cl_ev_send_msg(ProfChatWin *chatwin, const char *const msg, const char *const oob_url);
void cl_ev_send_muc_msg(ProfMucWin *mucwin, const char *const msg, const char *const oob_url);
void cl_ev_send_priv_msg(ProfPrivateWin *privwin, const char *const msg, const char *const oob_url);
#endif