Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
AloqaIM-Android
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
AloqaIM-Android
Commits
341e86e5
Commit
341e86e5
authored
Jan 30, 2017
by
Tiago Cunha
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ignores not registered servers
parent
5ee45e9f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
1 deletion
+17
-1
PushNotificationHandler.java
...ava/chat/rocket/android/push/PushNotificationHandler.java
+17
-1
No files found.
app/src/main/java/chat/rocket/android/push/PushNotificationHandler.java
View file @
341e86e5
...
...
@@ -29,9 +29,12 @@ import java.io.InputStream;
import
java.net.HttpURLConnection
;
import
java.net.URL
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Random
;
import
chat.rocket.android.activity.MainActivity
;
import
chat.rocket.android.helper.ServerPolicyHelper
;
import
chat.rocket.android.service.ConnectivityManager
;
import
chat.rocket.android.service.ServerInfo
;
public
class
PushNotificationHandler
implements
PushConstants
{
...
...
@@ -99,7 +102,7 @@ public class PushNotificationHandler implements PushConstants {
String
hostname
=
getHostname
(
extras
);
String
roomId
=
getRoomId
(
extras
);
if
(
hostname
==
null
||
roomId
==
null
)
{
if
(
hostname
==
null
||
roomId
==
null
||
!
isValidHostname
(
context
,
hostname
)
)
{
return
;
}
...
...
@@ -652,4 +655,17 @@ public class PushNotificationHandler implements PushConstants {
return
null
;
}
}
private
boolean
isValidHostname
(
Context
context
,
String
hostname
)
{
final
List
<
ServerInfo
>
serverInfoList
=
ConnectivityManager
.
getInstance
(
context
.
getApplicationContext
()).
getServerList
();
for
(
ServerInfo
serverInfo
:
serverInfoList
)
{
if
(
serverInfo
.
hostname
.
equals
(
hostname
))
{
return
true
;
}
}
return
false
;
}
}
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