Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Network
KDE Connect Android
Commits
d7c8f61c
Commit
d7c8f61c
authored
Apr 19, 2019
by
Nicolas Fella
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Unify coding style
parent
7da63109
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
36 deletions
+36
-36
src/org/kde/kdeconnect/Device.java
src/org/kde/kdeconnect/Device.java
+6
-6
src/org/kde/kdeconnect/Helpers/SMSHelper.java
src/org/kde/kdeconnect/Helpers/SMSHelper.java
+26
-26
src/org/kde/kdeconnect/Plugins/SMSPlugin/SMSPlugin.java
src/org/kde/kdeconnect/Plugins/SMSPlugin/SMSPlugin.java
+4
-4
No files found.
src/org/kde/kdeconnect/Device.java
View file @
d7c8f61c
...
@@ -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
;
}
}
}
}
src/org/kde/kdeconnect/Helpers/SMSHelper.java
View file @
d7c8f61c
...
@@ -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
;
}
}
}
}
...
...
src/org/kde/kdeconnect/Plugins/SMSPlugin/SMSPlugin.java
View file @
d7c8f61c
...
@@ -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
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment