Chans should now work.

Other deterministic addresses should be easy to implement, but aren't done yet
This commit is contained in:
2016-04-07 17:24:56 +02:00
parent ead5341b2e
commit 32ea3517fe
8 changed files with 70 additions and 16 deletions

View File

@ -116,6 +116,7 @@ public class BitmessageContext {
public BitmessageAddress joinChan(String passphrase, String address) {
BitmessageAddress chan = BitmessageAddress.chan(address, passphrase);
chan.setAlias(passphrase);
ctx.getAddressRepository().save(chan);
return chan;
}

View File

@ -73,7 +73,7 @@ class DefaultMessageListener implements NetworkHandler.MessageListener {
protected void receive(ObjectMessage object, GetPubkey getPubkey) {
BitmessageAddress identity = ctx.getAddressRepository().findIdentity(getPubkey.getRipeTag());
if (identity != null && identity.getPrivateKey() != null) {
if (identity != null && identity.getPrivateKey() != null && !identity.isChan()) {
LOG.info("Got pubkey request for identity " + identity);
// FIXME: only send pubkey if it wasn't sent in the last 28 days
ctx.sendPubkey(identity, object.getStream());

View File

@ -247,4 +247,8 @@ public class BitmessageAddress implements Serializable {
public boolean isChan() {
return chan;
}
public void setChan(boolean chan) {
this.chan = chan;
}
}

View File

@ -30,12 +30,17 @@ public interface AddressRepository {
*/
List<BitmessageAddress> getIdentities();
/**
* @return all subscribed chans.
*/
List<BitmessageAddress> getChans();
List<BitmessageAddress> getSubscriptions();
List<BitmessageAddress> getSubscriptions(long broadcastVersion);
/**
* @return all Bitmessage addresses that have no private key.
* @return all Bitmessage addresses that have no private key or are chans.
*/
List<BitmessageAddress> getContacts();