Allow following a feed that isn't in rhizome yet, and override the displayed name

This commit is contained in:
Jeremy Lakeman
2017-06-14 14:51:06 +09:30
parent 508e95436a
commit 9cb561229a
7 changed files with 99 additions and 41 deletions

View File

@ -220,8 +220,8 @@ public class ServalDClient implements ServalDHttpConnectionFactory {
return list;
}
public int meshmbAlterSubscription(Subscriber id, MeshMBCommon.SubscriptionAction action, SigningKey peer) throws ServalDInterfaceException, IOException {
return MeshMBCommon.alterSubscription(this, id, action, peer);
public int meshmbAlterSubscription(Subscriber id, MeshMBCommon.SubscriptionAction action, Subscriber peer, String name) throws ServalDInterfaceException, IOException {
return MeshMBCommon.alterSubscription(this, id, action, peer, name);
}
public MeshMBSubscriptionList meshmbSubscriptions(Subscriber identity) throws IOException, ServalDInterfaceException {

View File

@ -9,6 +9,7 @@ import org.servalproject.servaldna.Subscriber;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.util.Vector;
/**
* Created by jeremy on 5/10/16.
@ -34,8 +35,15 @@ public class MeshMBCommon {
return conn.getResponseCode();
}
public static int alterSubscription(ServalDHttpConnectionFactory connector, Subscriber id, SubscriptionAction action, SigningKey peer) throws ServalDInterfaceException, IOException {
HttpURLConnection conn = connector.newServalDHttpConnection("/restful/meshmb/" + id.signingKey.toHex() + "/"+action.toString().toLowerCase()+"/" + peer.toHex());
public static int alterSubscription(ServalDHttpConnectionFactory connector, Subscriber id, SubscriptionAction action, Subscriber peer, String name) throws ServalDInterfaceException, IOException {
Vector<ServalDHttpConnectionFactory.QueryParam> parms = new Vector<>();
parms.add(new ServalDHttpConnectionFactory.QueryParam("sender", peer.sid.toHex()));
if (name!=null && !"".equals(name))
parms.add(new ServalDHttpConnectionFactory.QueryParam("name", name));
HttpURLConnection conn = connector.newServalDHttpConnection(
"/restful/meshmb/"+id.signingKey.toHex()+"/"+peer.signingKey.toHex(),
parms
);
conn.setRequestMethod("POST");
conn.connect();
return conn.getResponseCode();