1 /* 2 * otr.h 3 * vim: expandtab:ts=4:sts=4:sw=4 4 * 5 * Copyright (C) 2012 - 2019 James Booth <boothj5@gmail.com> 6 * 7 * This file is part of Profanity. 8 * 9 * Profanity is free software: you can redistribute it and/or modify 10 * it under the terms of the GNU General Public License as published by 11 * the Free Software Foundation, either version 3 of the License, or 12 * (at your option) any later version. 13 * 14 * Profanity is distributed in the hope that it will be useful, 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 * GNU General Public License for more details. 18 * 19 * You should have received a copy of the GNU General Public License 20 * along with Profanity. If not, see <https://www.gnu.org/licenses/>. 21 * 22 * In addition, as a special exception, the copyright holders give permission to 23 * link the code of portions of this program with the OpenSSL library under 24 * certain conditions as described in each individual source file, and 25 * distribute linked combinations including the two. 26 * 27 * You must obey the GNU General Public License in all respects for all of the 28 * code used other than OpenSSL. If you modify file(s) with this exception, you 29 * may extend this exception to your version of the file(s), but you are not 30 * obligated to do so. If you do not wish to do so, delete this exception 31 * statement from your version. If you delete this exception statement from all 32 * source files in the program, then also delete it here. 33 * 34 */ 35 36 #ifndef OTR_OTR_H 37 #define OTR_OTR_H 38 39 #include <libotr/proto.h> 40 #include <libotr/message.h> 41 42 #include "config/accounts.h" 43 #include "ui/win_types.h" 44 45 typedef enum { 46 PROF_OTRPOLICY_MANUAL, 47 PROF_OTRPOLICY_OPPORTUNISTIC, 48 PROF_OTRPOLICY_ALWAYS 49 } prof_otrpolicy_t; 50 51 typedef enum { 52 PROF_OTR_SMP_INIT, 53 PROF_OTR_SMP_INIT_Q, 54 PROF_OTR_SMP_SENDER_FAIL, 55 PROF_OTR_SMP_RECEIVER_FAIL, 56 PROF_OTR_SMP_ABORT, 57 PROF_OTR_SMP_SUCCESS, 58 PROF_OTR_SMP_SUCCESS_Q, 59 PROF_OTR_SMP_FAIL_Q, 60 PROF_OTR_SMP_AUTH, 61 PROF_OTR_SMP_AUTH_WAIT 62 } prof_otr_smp_event_t; 63 64 OtrlUserState otr_userstate(void); 65 OtrlMessageAppOps* otr_messageops(void); 66 GHashTable* otr_smpinitators(void); 67 68 void otr_init(void); 69 void otr_shutdown(void); 70 char* otr_libotr_version(void); 71 char* otr_start_query(void); 72 void otr_poll(void); 73 void otr_on_connect(ProfAccount* account); 74 75 char* otr_on_message_recv(const char* const barejid, const char* const resource, const char* const message, gboolean* decrypted); 76 gboolean otr_on_message_send(ProfChatWin* chatwin, const char* const message, gboolean request_receipt, const char* const replace_id); 77 78 void otr_keygen(ProfAccount* account); 79 80 char* otr_tag_message(const char* const msg); 81 82 gboolean otr_key_loaded(void); 83 gboolean otr_is_secure(const char* const recipient); 84 85 gboolean otr_is_trusted(const char* const recipient); 86 void otr_trust(const char* const recipient); 87 void otr_untrust(const char* const recipient); 88 89 void otr_smp_secret(const char* const recipient, const char* secret); 90 void otr_smp_question(const char* const recipient, const char* question, const char* answer); 91 void otr_smp_answer(const char* const recipient, const char* answer); 92 93 void otr_end_session(const char* const recipient); 94 95 char* otr_get_my_fingerprint(void); 96 char* otr_get_their_fingerprint(const char* const recipient); 97 98 char* otr_encrypt_message(const char* const to, const char* const message); 99 char* otr_decrypt_message(const char* const from, const char* const message, 100 gboolean* decrypted); 101 102 void otr_free_message(char* message); 103 104 prof_otrpolicy_t otr_get_policy(const char* const recipient); 105 106 #endif 107