void sv_ev_outgoing_carbon(char *barejid, char *message, char *pgp_message) { ProfChatWin *chatwin = wins_get_chat(barejid); if (!chatwin) { chatwin = chatwin_new(barejid); } chat_state_active(chatwin->state); #ifdef HAVE_LIBGPGME if (pgp_message) { char *decrypted = p_gpg_decrypt(pgp_message); if (decrypted) { chatwin_outgoing_carbon(chatwin, decrypted, PROF_MSG_PGP); } else { chatwin_outgoing_carbon(chatwin, message, PROF_MSG_PLAIN); } } else { chatwin_outgoing_carbon(chatwin, message, PROF_MSG_PLAIN); } #else chatwin_outgoing_carbon(chatwin, message, PROF_MSG_PLAIN); #endif }
void cl_ev_send_msg(ProfChatWin *chatwin, const char *const msg) { chat_state_active(chatwin->state); // OTR suported, PGP supported #ifdef HAVE_LIBOTR #ifdef HAVE_LIBGPGME if (chatwin->pgp_send) { char *id = message_send_chat_pgp(chatwin->barejid, msg); chat_log_pgp_msg_out(chatwin->barejid, msg); chatwin_outgoing_msg(chatwin, msg, id, PROF_MSG_PGP); free(id); } else { gboolean handled = otr_on_message_send(chatwin, msg); if (!handled) { char *id = message_send_chat(chatwin->barejid, msg); chat_log_msg_out(chatwin->barejid, msg); chatwin_outgoing_msg(chatwin, msg, id, PROF_MSG_PLAIN); free(id); } } return; #endif #endif // OTR supported, PGP unsupported #ifdef HAVE_LIBOTR #ifndef HAVE_LIBGPGME gboolean handled = otr_on_message_send(chatwin, msg); if (!handled) { char *id = message_send_chat(chatwin->barejid, msg); chat_log_msg_out(chatwin->barejid, msg); chatwin_outgoing_msg(chatwin, msg, id, PROF_MSG_PLAIN); free(id); } return; #endif #endif // OTR unsupported, PGP supported #ifndef HAVE_LIBOTR #ifdef HAVE_LIBGPGME if (chatwin->pgp_send) { char *id = message_send_chat_pgp(chatwin->barejid, msg); chat_log_pgp_msg_out(chatwin->barejid, msg); chatwin_outgoing_msg(chatwin, msg, id, PROF_MSG_PGP); free(id); } else { char *id = message_send_chat(chatwin->barejid, msg); chat_log_msg_out(chatwin->barejid, msg); chatwin_outgoing_msg(chatwin, msg, id, PROF_MSG_PLAIN); free(id); } return; #endif #endif // OTR unsupported, PGP unsupported #ifndef HAVE_LIBOTR #ifndef HAVE_LIBGPGME char *id = message_send_chat(chatwin->barejid, msg); chat_log_msg_out(chatwin->barejid, msg); chatwin_outgoing_msg(chatwin, msg, id, PROF_MSG_PLAIN); free(id); return; #endif #endif }
void cl_ev_send_msg(ProfChatWin *chatwin, const char *const msg, const char *const oob_url) { chat_state_active(chatwin->state); gboolean request_receipt = FALSE; if (prefs_get_boolean(PREF_RECEIPTS_REQUEST)) { char *session_jid = chat_session_get_jid(chatwin->barejid); if (session_jid) { Jid *session_jidp = jid_create(session_jid); if (session_jidp && session_jidp->resourcepart) { if (caps_jid_has_feature(session_jid, XMPP_FEATURE_RECEIPTS)) { request_receipt = TRUE; } } jid_destroy(session_jidp); free(session_jid); } } char *plugin_msg = plugins_pre_chat_message_send(chatwin->barejid, msg); if (plugin_msg == NULL) { return; } // OTR suported, PGP supported #ifdef HAVE_LIBOTR #ifdef HAVE_LIBGPGME if (chatwin->pgp_send) { char *id = message_send_chat_pgp(chatwin->barejid, plugin_msg, request_receipt); chat_log_pgp_msg_out(chatwin->barejid, plugin_msg); chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_PGP, request_receipt); free(id); } else { gboolean handled = otr_on_message_send(chatwin, plugin_msg, request_receipt); if (!handled) { char *id = message_send_chat(chatwin->barejid, plugin_msg, oob_url, request_receipt); chat_log_msg_out(chatwin->barejid, plugin_msg); chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_PLAIN, request_receipt); free(id); } } plugins_post_chat_message_send(chatwin->barejid, plugin_msg); free(plugin_msg); return; #endif #endif // OTR supported, PGP unsupported #ifdef HAVE_LIBOTR #ifndef HAVE_LIBGPGME gboolean handled = otr_on_message_send(chatwin, plugin_msg, request_receipt); if (!handled) { char *id = message_send_chat(chatwin->barejid, plugin_msg, oob_url, request_receipt); chat_log_msg_out(chatwin->barejid, plugin_msg); chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_PLAIN, request_receipt); free(id); } plugins_post_chat_message_send(chatwin->barejid, plugin_msg); free(plugin_msg); return; #endif #endif // OTR unsupported, PGP supported #ifndef HAVE_LIBOTR #ifdef HAVE_LIBGPGME if (chatwin->pgp_send) { char *id = message_send_chat_pgp(chatwin->barejid, plugin_msg, request_receipt); chat_log_pgp_msg_out(chatwin->barejid, plugin_msg); chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_PGP, request_receipt); free(id); } else { char *id = message_send_chat(chatwin->barejid, plugin_msg, oob_url, request_receipt); chat_log_msg_out(chatwin->barejid, plugin_msg); chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_PLAIN, request_receipt); free(id); } plugins_post_chat_message_send(chatwin->barejid, plugin_msg); free(plugin_msg); return; #endif #endif // OTR unsupported, PGP unsupported #ifndef HAVE_LIBOTR #ifndef HAVE_LIBGPGME char *id = message_send_chat(chatwin->barejid, plugin_msg, oob_url, request_receipt); chat_log_msg_out(chatwin->barejid, plugin_msg); chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_PLAIN, request_receipt); free(id); plugins_post_chat_message_send(chatwin->barejid, plugin_msg); free(plugin_msg); return; #endif #endif }