Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xabber-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
xabber-android
Commits
d90031c0
Commit
d90031c0
authored
Jun 24, 2015
by
Grigory Fedorov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OTRManager refreshes session of contact become unavailable (goes offline). Should fix #413
parent
a7e4a25f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
3 deletions
+24
-3
OTRManager.java
...ava/com/xabber/android/data/extension/otr/OTRManager.java
+16
-0
RegularChat.java
...ain/java/com/xabber/android/data/message/RegularChat.java
+8
-3
No files found.
app/src/main/java/com/xabber/android/data/extension/otr/OTRManager.java
View file @
d90031c0
...
...
@@ -653,4 +653,20 @@ public class OTRManager implements OtrEngineHost, OtrEngineListener,
// since this is not supported, we don't need to do anything
}
public
void
onContactUnAvailable
(
String
account
,
String
user
)
{
Session
session
=
sessions
.
get
(
account
,
user
);
if
(
session
==
null
)
{
return
;
}
if
(
session
.
getSessionStatus
()
==
SessionStatus
.
ENCRYPTED
)
{
try
{
LogManager
.
i
(
this
,
"onContactUnAvailable. Refresh session for "
+
user
);
session
.
refreshSession
();
}
catch
(
OtrException
e
)
{
LogManager
.
exception
(
this
,
e
);
}
}
}
}
app/src/main/java/com/xabber/android/data/message/RegularChat.java
View file @
d90031c0
...
...
@@ -120,10 +120,15 @@ public class RegularChat extends AbstractChat {
final
String
resource
=
Jid
.
getResource
(
packet
.
getFrom
());
if
(
packet
instanceof
Presence
)
{
final
Presence
presence
=
(
Presence
)
packet
;
if
(
this
.
resource
!=
null
&&
presence
.
getType
()
==
Presence
.
Type
.
unavailable
&&
this
.
resource
.
equals
(
resource
))
if
(
this
.
resource
!=
null
&&
presence
.
getType
()
==
Presence
.
Type
.
unavailable
&&
this
.
resource
.
equals
(
resource
))
{
this
.
resource
=
null
;
}
if
(
presence
.
getType
()
==
Presence
.
Type
.
unavailable
)
{
OTRManager
.
getInstance
().
onContactUnAvailable
(
account
,
user
);
}
}
else
if
(
packet
instanceof
Message
)
{
final
Message
message
=
(
Message
)
packet
;
if
(
message
.
getType
()
==
Message
.
Type
.
error
)
...
...
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