Commit d7c8f61c authored by Nicolas Fella's avatar Nicolas Fella

Unify coding style

parent 7da63109
...@@ -77,7 +77,7 @@ public class Device implements BaseLink.PacketReceiver { ...@@ -77,7 +77,7 @@ public class Device implements BaseLink.PacketReceiver {
private final CopyOnWriteArrayList<BaseLink> links = new CopyOnWriteArrayList<>(); private final CopyOnWriteArrayList<BaseLink> links = new CopyOnWriteArrayList<>();
private List<String> m_supportedPlugins = new ArrayList<>(); private List<String> supportedPlugins = new ArrayList<>();
private final ConcurrentHashMap<String, Plugin> plugins = new ConcurrentHashMap<>(); private final ConcurrentHashMap<String, Plugin> plugins = new ConcurrentHashMap<>();
private final ConcurrentHashMap<String, Plugin> pluginsWithoutPermissions = new ConcurrentHashMap<>(); private final ConcurrentHashMap<String, Plugin> pluginsWithoutPermissions = new ConcurrentHashMap<>();
private final ConcurrentHashMap<String, Plugin> pluginsWithoutOptionalPermissions = new ConcurrentHashMap<>(); private final ConcurrentHashMap<String, Plugin> pluginsWithoutOptionalPermissions = new ConcurrentHashMap<>();
...@@ -147,7 +147,7 @@ public class Device implements BaseLink.PacketReceiver { ...@@ -147,7 +147,7 @@ public class Device implements BaseLink.PacketReceiver {
this.deviceType = DeviceType.FromString(settings.getString("deviceType", "desktop")); this.deviceType = DeviceType.FromString(settings.getString("deviceType", "desktop"));
//Assume every plugin is supported until addLink is called and we can get the actual list //Assume every plugin is supported until addLink is called and we can get the actual list
m_supportedPlugins = new Vector<>(PluginFactory.getAvailablePlugins()); supportedPlugins = new Vector<>(PluginFactory.getAvailablePlugins());
//Do not load plugins yet, the device is not present //Do not load plugins yet, the device is not present
//reloadPluginsFromSettings(); //reloadPluginsFromSettings();
...@@ -494,9 +494,9 @@ public class Device implements BaseLink.PacketReceiver { ...@@ -494,9 +494,9 @@ public class Device implements BaseLink.PacketReceiver {
Set<String> outgoingCapabilities = identityPacket.getStringSet("outgoingCapabilities", null); Set<String> outgoingCapabilities = identityPacket.getStringSet("outgoingCapabilities", null);
Set<String> incomingCapabilities = identityPacket.getStringSet("incomingCapabilities", null); Set<String> incomingCapabilities = identityPacket.getStringSet("incomingCapabilities", null);
if (incomingCapabilities != null && outgoingCapabilities != null) { if (incomingCapabilities != null && outgoingCapabilities != null) {
m_supportedPlugins = new Vector<>(PluginFactory.pluginsForCapabilities(incomingCapabilities, outgoingCapabilities)); supportedPlugins = new Vector<>(PluginFactory.pluginsForCapabilities(incomingCapabilities, outgoingCapabilities));
} else { } else {
m_supportedPlugins = new Vector<>(PluginFactory.getAvailablePlugins()); supportedPlugins = new Vector<>(PluginFactory.getAvailablePlugins());
} }
link.addPacketReceiver(this); link.addPacketReceiver(this);
...@@ -757,7 +757,7 @@ public class Device implements BaseLink.PacketReceiver { ...@@ -757,7 +757,7 @@ public class Device implements BaseLink.PacketReceiver {
HashMap<String, ArrayList<String>> newPluginsByIncomingInterface = new HashMap<>(); HashMap<String, ArrayList<String>> newPluginsByIncomingInterface = new HashMap<>();
for (String pluginKey : m_supportedPlugins) { for (String pluginKey : supportedPlugins) {
PluginFactory.PluginInfo pluginInfo = PluginFactory.getPluginInfo(pluginKey); PluginFactory.PluginInfo pluginInfo = PluginFactory.getPluginInfo(pluginKey);
...@@ -837,7 +837,7 @@ public class Device implements BaseLink.PacketReceiver { ...@@ -837,7 +837,7 @@ public class Device implements BaseLink.PacketReceiver {
} }
public List<String> getSupportedPlugins() { public List<String> getSupportedPlugins() {
return m_supportedPlugins; return supportedPlugins;
} }
} }
...@@ -146,7 +146,7 @@ public class SMSHelper { ...@@ -146,7 +146,7 @@ public class SMSHelper {
} }
Message message = new Message(messageInfo); Message message = new Message(messageInfo);
ThreadID threadID = new ThreadID(message.m_threadID); ThreadID threadID = new ThreadID(message.threadID);
if (!toReturn.containsKey(threadID)) { if (!toReturn.containsKey(threadID)) {
toReturn.put(threadID, new ArrayList<>()); toReturn.put(threadID, new ArrayList<>());
...@@ -224,12 +224,12 @@ public class SMSHelper { ...@@ -224,12 +224,12 @@ public class SMSHelper {
@NonNull @NonNull
public String toString() { public String toString() {
return this.threadID.toString(); return threadID.toString();
} }
@Override @Override
public int hashCode() { public int hashCode() {
return this.threadID.hashCode(); return threadID.hashCode();
} }
@Override @Override
...@@ -243,13 +243,13 @@ public class SMSHelper { ...@@ -243,13 +243,13 @@ public class SMSHelper {
*/ */
public static class Message { public static class Message {
final String m_address; final String address;
final String m_body; final String body;
public final long m_date; public final long date;
final int m_type; final int type;
final int m_read; final int read;
final long m_threadID; // ThreadID is *int* for SMS messages but *long* for MMS final long threadID; // ThreadID is *int* for SMS messages but *long* for MMS
final int m_uID; final int uID;
/** /**
* Named constants which are used to construct a Message * Named constants which are used to construct a Message
...@@ -285,40 +285,40 @@ public class SMSHelper { ...@@ -285,40 +285,40 @@ public class SMSHelper {
}; };
Message(final HashMap<String, String> messageInfo) { Message(final HashMap<String, String> messageInfo) {
m_address = messageInfo.get(Message.ADDRESS); address = messageInfo.get(Message.ADDRESS);
m_body = messageInfo.get(Message.BODY); body = messageInfo.get(Message.BODY);
m_date = Long.parseLong(messageInfo.get(Message.DATE)); date = Long.parseLong(messageInfo.get(Message.DATE));
if (messageInfo.get(Message.TYPE) == null) if (messageInfo.get(Message.TYPE) == null)
{ {
// To be honest, I have no idea why this happens. The docs say the TYPE field is mandatory. // To be honest, I have no idea why this happens. The docs say the TYPE field is mandatory.
// Just stick some junk in here and hope we can figure it out later. // Just stick some junk in here and hope we can figure it out later.
// Quick investigation suggests that these are multi-target MMSes // Quick investigation suggests that these are multi-target MMSes
m_type = -1; type = -1;
} else { } else {
m_type = Integer.parseInt(messageInfo.get(Message.TYPE)); type = Integer.parseInt(messageInfo.get(Message.TYPE));
} }
m_read = Integer.parseInt(messageInfo.get(Message.READ)); read = Integer.parseInt(messageInfo.get(Message.READ));
m_threadID = Long.parseLong(messageInfo.get(Message.THREAD_ID)); threadID = Long.parseLong(messageInfo.get(Message.THREAD_ID));
m_uID = Integer.parseInt(messageInfo.get(Message.U_ID)); uID = Integer.parseInt(messageInfo.get(Message.U_ID));
} }
public JSONObject toJSONObject() throws JSONException { public JSONObject toJSONObject() throws JSONException {
JSONObject json = new JSONObject(); JSONObject json = new JSONObject();
json.put(Message.ADDRESS, m_address); json.put(Message.ADDRESS, address);
json.put(Message.BODY, m_body); json.put(Message.BODY, body);
json.put(Message.DATE, m_date); json.put(Message.DATE, date);
json.put(Message.TYPE, m_type); json.put(Message.TYPE, type);
json.put(Message.READ, m_read); json.put(Message.READ, read);
json.put(Message.THREAD_ID, m_threadID); json.put(Message.THREAD_ID, threadID);
json.put(Message.U_ID, m_uID); json.put(Message.U_ID, uID);
return json; return json;
} }
@Override @Override
public String toString() { public String toString() {
return this.m_body; return body;
} }
} }
......
...@@ -204,8 +204,8 @@ public class SMSPlugin extends Plugin { ...@@ -204,8 +204,8 @@ public class SMSPlugin extends Plugin {
// Update the most recent counter // Update the most recent counter
mostRecentTimestampLock.lock(); mostRecentTimestampLock.lock();
for (SMSHelper.Message message : messages) { for (SMSHelper.Message message : messages) {
if (message.m_date > mostRecentTimestamp) { if (message.date > mostRecentTimestamp) {
mPlugin.mostRecentTimestamp = message.m_date; mPlugin.mostRecentTimestamp = message.date;
} }
} }
mostRecentTimestampLock.unlock(); mostRecentTimestampLock.unlock();
...@@ -374,8 +374,8 @@ public class SMSPlugin extends Plugin { ...@@ -374,8 +374,8 @@ public class SMSPlugin extends Plugin {
// recent in every conversation // recent in every conversation
mostRecentTimestampLock.lock(); mostRecentTimestampLock.lock();
for (SMSHelper.Message message : conversations.values()) { for (SMSHelper.Message message : conversations.values()) {
if (message.m_date > mostRecentTimestamp) { if (message.date > mostRecentTimestamp) {
mostRecentTimestamp = message.m_date; mostRecentTimestamp = message.date;
} }
} }
mostRecentTimestampLock.unlock(); mostRecentTimestampLock.unlock();
......
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