Skip to content
This repository has been archived by the owner on Jun 7, 2023. It is now read-only.

Commit

Permalink
update to ict 0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
vuapo-eth committed Mar 29, 2019
1 parent 00a3fd0 commit b8afa7a
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 19 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Expand Up @@ -4,7 +4,7 @@ plugins {
}

group 'org.iota.'
version '1.4'
version '1.5'

sourceCompatibility = 1.8

Expand All @@ -14,7 +14,7 @@ repositories {
}

dependencies {
compile 'com.github.iotaledger:ict:046dc88c9514a4356224ebb9c9a4f5374c7d8710'
compile 'com.github.iotaledger:ict:0.6'
compile group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.11.1'
compile group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.11.1'
compile group: 'org.slf4j', name: 'slf4j-simple', version: '1.7.21'
Expand Down
42 changes: 27 additions & 15 deletions src/main/java/org/iota/ixi/chat/ChatIxi.java
Expand Up @@ -7,15 +7,16 @@
import org.iota.ict.ixi.IxiModule;
import org.iota.ict.ixi.context.ConfigurableIxiContext;
import org.iota.ict.ixi.context.IxiContext;
import org.iota.ict.model.transaction.Transaction;
import org.iota.ict.network.gossip.GossipEvent;
import org.iota.ict.network.gossip.GossipFilter;
import org.iota.ict.network.gossip.GossipListener;
import org.iota.ict.utils.IOHelper;
import org.iota.ixi.chat.model.Credentials;
import org.iota.ixi.chat.model.Message;
import org.iota.ixi.chat.model.MessageBuilder;
import org.iota.ixi.chat.utils.KeyManager;
import org.iota.ixi.chat.utils.KeyPair;
import org.iota.ict.model.Transaction;
import org.iota.ict.network.event.GossipEvent;
import org.iota.ict.network.event.GossipFilter;
import org.iota.ict.utils.Trytes;
import org.iota.ixi.chat.utils.PasswordGenerator;
import org.iota.ixi.chat.utils.aes_key_length.AESKeyLengthFix;
Expand Down Expand Up @@ -68,22 +69,33 @@ public ChatIxi(Ixi ixi) {
// context.store(); TODO
context.contacts.add(userid);

ixi.addGossipListener((GossipEvent event) -> {
if(gossipFilter.passes(event.getTransaction()))
addTransactionToQueue(event.getTransaction());
});
GossipListener listener = new GossipListener.Implementation() {
@Override
public void onReceive(GossipEvent event) {
if (gossipFilter.passes(event.getTransaction()))
addTransactionToQueue(event.getTransaction());
}
};

ixi.addListener(listener);
}

@Override
public void install() {
try {
if(!DIRECTORY.exists())
DIRECTORY.mkdirs();
if (!WEB_DIRECTORY.exists())
IOHelper.extractDirectoryFromJarFile(ChatIxi.class, "web/", WEB_DIRECTORY.getPath());
} catch (IOException e) {
throw new RuntimeException(e);
}
if(startedFromJar())
try {
if(!DIRECTORY.exists())
DIRECTORY.mkdirs();
if (!WEB_DIRECTORY.exists())
IOHelper.extractDirectoryFromJarFile(ChatIxi.class, "web/", WEB_DIRECTORY.getPath());
} catch (IOException e) {
throw new RuntimeException(e);
}
}

private static boolean startedFromJar() {
String pathToChatIXI = ChatIxi.class.getProtectionDomain().getCodeSource().getLocation().getPath();
return pathToChatIXI.endsWith(".jar");
}

@Override
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/iota/ixi/chat/model/Message.java
@@ -1,8 +1,8 @@
package org.iota.ixi.chat.model;

import com.iota.curl.IotaCurlHash;
import org.iota.ict.model.Transaction;
import org.iota.ict.model.TransactionBuilder;
import org.iota.ict.model.transaction.Transaction;
import org.iota.ict.model.transaction.TransactionBuilder;
import org.iota.ict.utils.Trytes;
import org.iota.ixi.chat.ChatIxi;
import org.iota.ixi.chat.utils.AES;
Expand Down

0 comments on commit b8afa7a

Please sign in to comment.