Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
Openfire
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
Openfire
Commits
158e2839
Commit
158e2839
authored
Jan 08, 2016
by
Guus der Kinderen
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #500 from surevine/OF-1034
OF-1034 Check for existing sessions properly
parents
3bd2679c
13a19a23
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
2 deletions
+16
-2
MessageRouter.java
src/java/org/jivesoftware/openfire/MessageRouter.java
+16
-2
No files found.
src/java/org/jivesoftware/openfire/MessageRouter.java
View file @
158e2839
...
...
@@ -38,6 +38,7 @@ import org.xmpp.packet.Message;
import
org.xmpp.packet.Packet
;
import
org.xmpp.packet.PacketError
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.StringTokenizer
;
...
...
@@ -250,9 +251,22 @@ public class MessageRouter extends BasicModule {
{
log
.
debug
(
"Message sent to unreachable address: "
+
packet
.
toXML
()
);
final
Message
msg
=
(
Message
)
packet
;
boolean
storeOffline
=
true
;
if
(
msg
.
getType
().
equals
(
Message
.
Type
.
chat
)
&&
serverName
.
equals
(
recipient
.
getDomain
()
)
&&
recipient
.
getResource
()
!=
null
&&
routingTable
.
hasClientRoute
(
recipient
.
asBareJID
()
)
)
if
(
msg
.
getType
().
equals
(
Message
.
Type
.
chat
)
&&
serverName
.
equals
(
recipient
.
getDomain
()
)
&&
recipient
.
getResource
()
!=
null
)
{
// Find an existing AVAILABLE session with non-negative priority.
for
(
JID
address
:
routingTable
.
getRoutes
(
recipient
.
asBareJID
(),
packet
.
getFrom
()))
{
ClientSession
session
=
routingTable
.
getClientRoute
(
address
);
if
(
session
!=
null
&&
session
.
isInitialized
())
{
if
(
session
.
getPresence
().
getPriority
()
>=
1
)
{
storeOffline
=
false
;
}
}
}
}
if
(
!
storeOffline
)
{
// If message was sent to an unavailable full JID of a user then retry using the bare JID.
routingTable
.
routePacket
(
recipient
.
asBareJID
(),
packet
,
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