Commit 5878cde5 authored by Richard Bayerle's avatar Richard Bayerle
Browse files

Now interoperable with conversations and gajim-OMEMO! Plus minor improvements.

Bundle is now published at every start, not only with the devicelist.
Removed unnecessary includes.
Exchanged includes that are dependent on a path for a compiler argument.
parent 158224f3
......@@ -3,6 +3,12 @@ In German, an Axolotl is a type of Lurch. This plugin brings Axolotl, by now ren
(Plus I thought the word sounds funny, especially when pronounced by a speaker of English.)
## Can it talk to conversations.im, the gajim OMEMO plugin, ...?
__Yes__.
## Do group chats work?
Yes.
## Dependencies (aside from libpurple)
* [axc](https://github.com/gkdr/axc)
* [libomemo](https://github.com/gkdr/libomemo)
......@@ -29,12 +35,7 @@ Additionally, the room has to be set to non-anonymous so that the full JID of ev
More information can be found by typing `/lurch help` in any conversation window.
## Caveats
[OMEMO's now official XEP](https://xmpp.org/extensions/xep-0384.html) changed the used double ratchet implementation from Axolotl to Olm (which is also an amphibian, we are all very creative with names it seems). I noticed this way too late and am still using libaxolotl. No, not even Signal - I did not update the dependency in axc for reasons outlined in its own readme.
libpurple does not have support for Carbons or MAM, both used to deliver functionality that the OMEMO protocol can do in theory, which is messages to multiple devices and catchup with messages that were sent while a device was offline.
It should not be hard to fix but should be rather done on libpurple's side.
For this reason, lurch uses its own namespace and is not interoperable with any other OMEMO applications at this moment.
If there is enough interest, I will fix this at some point.
It should not be hard to fix but should be rather done on libpurple's side. I'm looking into it.
Of course this plugin is _highly experimental_, so you should not trust your life on it.
......@@ -17,13 +17,13 @@ AXC_BUILD=$(AXC_DIR)/build
LFLAGS=-lmxml -pthread -ldl -lm -lcrypto -lglib-2.0 -lxml2 -L/usr/lib/purple-2/ -ljabber -lsqlite3 -laxolotl-c
export PLUGIN_LIBS= ../../../$(LOMEMO_BUILD)/libomemo.la ../../../$(AXC_BUILD)/libaxc.la $(LFLAGS)
export PLUGIN_CFLAGS=-I/usr/include/libxml2
export PLUGIN_CFLAGS=-I/usr/include/libxml2 -I../../../$(LOMEMO_SRC) -I../../../$(AXC_SRC)
all: lurch
.PHONY: libomemo
libomemo: $(LOMEMO_DIR)
cd $(LOMEMO_DIR) && make libomemo-lurch
cd $(LOMEMO_DIR) && make libomemo-conversations
libaxc: $(AXC_DIR)
cd $(AXC_DIR) && make $@
......
......@@ -7,8 +7,6 @@
#include <string.h>
#include <time.h>
#include <axolotl/axolotl.h>
#include "account.h"
#include "cmds.h"
#include "conversation.h"
......@@ -23,12 +21,12 @@
#include "protocols/jabber/jutil.h"
#include "protocols/jabber/pep.h"
#include "../../../lib/libomemo/src/libomemo.h"
#include "../../../lib/libomemo/src/libomemo_crypto.h"
#include "../../../lib/libomemo/src/libomemo_storage.h"
#include "libomemo.h"
#include "libomemo_crypto.h"
#include "libomemo_storage.h"
#include "../../../lib/axc/src/axc.h"
#include "../../../lib/axc/src/axc_store.h"
#include "axc.h"
#include "axc_store.h"
#define JABBER_PROTOCOL_ID "prpl-jabber"
......@@ -594,7 +592,7 @@ static int lurch_bundle_create_session(const char * uname,
ret_val = omemo_bundle_import(xmlnode_to_str(items_p, &len), &om_bundle_p);
if (ret_val) {
err_msg_dbg = g_strdup_printf("failed to import xml unto bundle");
err_msg_dbg = g_strdup_printf("failed to import xml into bundle");
goto cleanup;
}
......@@ -819,7 +817,6 @@ cleanup:
if (err_msg_dbg) {
purple_conv_present_error(recipient, purple_connection_get_account(js_p->gc), LURCH_ERR_STRING_ENCRYPT);
purple_debug_error("lurch", "%s: %s (%i)\n", __func__, err_msg_dbg, ret_val);
free(err_msg_dbg);
}
if (sem_db_waiting) {
......@@ -1127,12 +1124,6 @@ static void lurch_pep_own_devicelist_request_handler(JabberStream * js_p, const
err_msg_dbg = g_strdup_printf("failed to prepare axc");
goto cleanup;
}
ret_val = lurch_bundle_publish_own(js_p);
if (ret_val) {
err_msg_dbg = g_strdup_printf("failed to publish own bundle");
goto cleanup;
}
purple_debug_info("lurch", "%s: %s\n", __func__, "...done");
}
......@@ -1203,6 +1194,12 @@ static void lurch_pep_own_devicelist_request_handler(JabberStream * js_p, const
purple_debug_info("lurch", "%s: \n%s:\n", __func__, "...done");
}
ret_val = lurch_bundle_publish_own(js_p);
if (ret_val) {
err_msg_dbg = g_strdup_printf("failed to publish own bundle");
goto cleanup;
}
if (install && !uninstall) {
purple_account_set_bool(acc_p, LURCH_ACC_SETTING_INITIALIZED, TRUE);
}
......@@ -1758,6 +1755,9 @@ static void lurch_message_encrypt_groupchat(PurpleConnection * gc_p, xmlnode **
goto cleanup;
}
body_node_p = xmlnode_get_child(*msg_stanza_pp, "body");
xmlnode_free(body_node_p);
cleanup:
if (err_msg_dbg) {
purple_conv_present_error(purple_conversation_get_name(conv_p), purple_connection_get_account(gc_p), LURCH_ERR_STRING_ENCRYPT);
......@@ -1781,15 +1781,14 @@ cleanup:
}
static void lurch_xml_sent_cb(PurpleConnection * gc_p, xmlnode ** stanza_pp) {
xmlnode * body_node_p = (void *) 0;
char * node_name = (*stanza_pp)->name;
const char * type = xmlnode_get_attrib(*stanza_pp, "type");
xmlnode * body_node_p = (void *) 0;
if (uninstall) {
return;
}
if (!g_strcmp0(node_name, "message")) {
body_node_p = xmlnode_get_child(*stanza_pp, "body");
if (!body_node_p) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment