mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-19 06:09:55 +01:00
Translatable names for plugins, for use in the UI.
This commit is contained in:
@@ -11,6 +11,9 @@ public interface Plugin {
|
|||||||
/** Returns the plugin's transport identifier. */
|
/** Returns the plugin's transport identifier. */
|
||||||
TransportId getId();
|
TransportId getId();
|
||||||
|
|
||||||
|
/** Returns a label for looking up the plugin's translated name. */
|
||||||
|
String getName();
|
||||||
|
|
||||||
/** Starts the plugin. */
|
/** Starts the plugin. */
|
||||||
void start() throws IOException;
|
void start() throws IOException;
|
||||||
|
|
||||||
|
|||||||
@@ -73,6 +73,10 @@ class BluetoothPlugin implements DuplexPlugin {
|
|||||||
return ID;
|
return ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return "BLUETOOTH_PLUGIN_NAME";
|
||||||
|
}
|
||||||
|
|
||||||
public void start() throws IOException {
|
public void start() throws IOException {
|
||||||
// Initialise the Bluetooth stack
|
// Initialise the Bluetooth stack
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -85,6 +85,11 @@ class DroidtoothPlugin implements DuplexPlugin {
|
|||||||
return ID;
|
return ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
// Share a name with the J2SE Bluetooth plugin
|
||||||
|
return "BLUETOOTH_PLUGIN_NAME";
|
||||||
|
}
|
||||||
|
|
||||||
public void start() throws IOException {
|
public void start() throws IOException {
|
||||||
// BluetoothAdapter.getDefaultAdapter() must be called on a thread
|
// BluetoothAdapter.getDefaultAdapter() must be called on a thread
|
||||||
// with a message queue, so submit it to the AndroidExecutor
|
// with a message queue, so submit it to the AndroidExecutor
|
||||||
|
|||||||
@@ -66,6 +66,10 @@ class GmailPlugin implements SimplexPlugin {
|
|||||||
return ID;
|
return ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return "GMAIL_PLUGIN_NAME";
|
||||||
|
}
|
||||||
|
|
||||||
public void start() throws IOException {
|
public void start() throws IOException {
|
||||||
pluginExecutor.execute(new Runnable() {
|
pluginExecutor.execute(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
@@ -148,11 +152,11 @@ class GmailPlugin implements SimplexPlugin {
|
|||||||
Session session;
|
Session session;
|
||||||
session = Session.getInstance(props,
|
session = Session.getInstance(props,
|
||||||
new Authenticator() {
|
new Authenticator() {
|
||||||
protected PasswordAuthentication getPasswordAuthentication() {
|
protected PasswordAuthentication getPasswordAuthentication() {
|
||||||
return new PasswordAuthentication(
|
return new PasswordAuthentication(
|
||||||
userPass.get(0), userPass.get(1));
|
userPass.get(0), userPass.get(1));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
sent = sendMessage(session, cid);
|
sent = sendMessage(session, cid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,13 +21,13 @@ class RemovableDrivePlugin extends FilePlugin
|
|||||||
implements RemovableDriveMonitor.Callback {
|
implements RemovableDriveMonitor.Callback {
|
||||||
|
|
||||||
public static final byte[] TRANSPORT_ID =
|
public static final byte[] TRANSPORT_ID =
|
||||||
StringUtils.fromHexString("7c81bf5c9b1cd557685548c85f976bbd"
|
StringUtils.fromHexString("7c81bf5c9b1cd557685548c85f976bbd"
|
||||||
+ "e633d2418ea2e230e5710fb43c6f8cc0"
|
+ "e633d2418ea2e230e5710fb43c6f8cc0"
|
||||||
+ "68abca3a9d0edb13bcea13b851725c5d");
|
+ "68abca3a9d0edb13bcea13b851725c5d");
|
||||||
|
|
||||||
private static final TransportId ID = new TransportId(TRANSPORT_ID);
|
private static final TransportId ID = new TransportId(TRANSPORT_ID);
|
||||||
private static final Logger LOG =
|
private static final Logger LOG =
|
||||||
Logger.getLogger(RemovableDrivePlugin.class.getName());
|
Logger.getLogger(RemovableDrivePlugin.class.getName());
|
||||||
|
|
||||||
private final RemovableDriveFinder finder;
|
private final RemovableDriveFinder finder;
|
||||||
private final RemovableDriveMonitor monitor;
|
private final RemovableDriveMonitor monitor;
|
||||||
@@ -44,6 +44,10 @@ implements RemovableDriveMonitor.Callback {
|
|||||||
return ID;
|
return ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return "REMOVABLE_DRIVE_PLUGIN_NAME";
|
||||||
|
}
|
||||||
|
|
||||||
public void start() throws IOException {
|
public void start() throws IOException {
|
||||||
running = true;
|
running = true;
|
||||||
monitor.start(this);
|
monitor.start(this);
|
||||||
@@ -70,7 +74,7 @@ implements RemovableDriveMonitor.Callback {
|
|||||||
protected File chooseOutputDirectory() {
|
protected File chooseOutputDirectory() {
|
||||||
try {
|
try {
|
||||||
List<File> drives =
|
List<File> drives =
|
||||||
new ArrayList<File>(finder.findRemovableDrives());
|
new ArrayList<File>(finder.findRemovableDrives());
|
||||||
if(drives.isEmpty()) return null;
|
if(drives.isEmpty()) return null;
|
||||||
String[] paths = new String[drives.size()];
|
String[] paths = new String[drives.size()];
|
||||||
for(int i = 0; i < paths.length; i++) {
|
for(int i = 0; i < paths.length; i++) {
|
||||||
|
|||||||
@@ -51,6 +51,10 @@ class LanTcpPlugin extends TcpPlugin {
|
|||||||
return ID;
|
return ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return "LAN_TCP_PLUGIN_NAME";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected List<SocketAddress> getLocalSocketAddresses() {
|
protected List<SocketAddress> getLocalSocketAddresses() {
|
||||||
List<SocketAddress> addrs = new ArrayList<SocketAddress>();
|
List<SocketAddress> addrs = new ArrayList<SocketAddress>();
|
||||||
|
|||||||
@@ -48,6 +48,10 @@ class WanTcpPlugin extends TcpPlugin {
|
|||||||
return ID;
|
return ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return "WAN_TCP_PLUGIN_NAME";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected List<SocketAddress> getLocalSocketAddresses() {
|
protected List<SocketAddress> getLocalSocketAddresses() {
|
||||||
List<SocketAddress> addrs = new ArrayList<SocketAddress>();
|
List<SocketAddress> addrs = new ArrayList<SocketAddress>();
|
||||||
|
|||||||
@@ -63,6 +63,10 @@ class TorPlugin implements DuplexPlugin {
|
|||||||
return ID;
|
return ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return "TOR_PLUGIN_NAME";
|
||||||
|
}
|
||||||
|
|
||||||
public void start() throws IOException {
|
public void start() throws IOException {
|
||||||
synchronized(this) {
|
synchronized(this) {
|
||||||
running = true;
|
running = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user