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
4a1fae99
Commit
4a1fae99
authored
Jul 10, 2015
by
Grigory Fedorov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ConnectionManager light refactoring.
parent
687c63ae
Changes
16
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
81 additions
and
104 deletions
+81
-104
ConnectionManager.java
...com/xabber/android/data/connection/ConnectionManager.java
+51
-71
MessageArchiveManager.java
...android/data/extension/archive/MessageArchiveManager.java
+8
-8
AttentionManager.java
...er/android/data/extension/attention/AttentionManager.java
+1
-1
CapabilitiesManager.java
...ndroid/data/extension/capability/CapabilitiesManager.java
+1
-1
ChatStateManager.java
...om/xabber/android/data/extension/cs/ChatStateManager.java
+1
-1
MUCManager.java
...ava/com/xabber/android/data/extension/muc/MUCManager.java
+1
-2
OTRManager.java
...ava/com/xabber/android/data/extension/otr/OTRManager.java
+1
-1
PingManager.java
...a/com/xabber/android/data/extension/ping/PingManager.java
+1
-1
SSNManager.java
...ava/com/xabber/android/data/extension/ssn/SSNManager.java
+1
-1
TimeManager.java
...a/com/xabber/android/data/extension/time/TimeManager.java
+1
-1
VCardManager.java
...com/xabber/android/data/extension/vcard/VCardManager.java
+1
-2
AbstractChat.java
...in/java/com/xabber/android/data/message/AbstractChat.java
+1
-2
ReceiptManager.java
.../java/com/xabber/android/data/message/ReceiptManager.java
+1
-1
PresenceManager.java
.../java/com/xabber/android/data/roster/PresenceManager.java
+4
-4
RosterManager.java
...in/java/com/xabber/android/data/roster/RosterManager.java
+6
-6
CarbonManager.java
app/src/main/java/com/xabber/xmpp/carbon/CarbonManager.java
+1
-1
No files found.
app/src/main/java/com/xabber/android/data/connection/ConnectionManager.java
View file @
4a1fae99
This diff is collapsed.
Click to expand it.
app/src/main/java/com/xabber/android/data/extension/archive/MessageArchiveManager.java
View file @
4a1fae99
...
...
@@ -337,7 +337,7 @@ public class MessageArchiveManager implements OnPacketListener,
auto
.
setSave
(
true
);
auto
.
setType
(
Type
.
set
);
try
{
ConnectionManager
.
getInstance
().
send
Packet
(
account
,
auto
);
ConnectionManager
.
getInstance
().
send
Stanza
(
account
,
auto
);
}
catch
(
NetworkException
e
)
{
}
// TODO: track results.
...
...
@@ -394,7 +394,7 @@ public class MessageArchiveManager implements OnPacketListener,
pref
.
setDefault
(
defaultItem
);
pref
.
setType
(
Type
.
set
);
try
{
ConnectionManager
.
getInstance
().
send
Packet
(
account
,
pref
);
ConnectionManager
.
getInstance
().
send
Stanza
(
account
,
pref
);
}
catch
(
NetworkException
e
)
{
}
}
...
...
@@ -703,7 +703,7 @@ public class MessageArchiveManager implements OnPacketListener,
packet
.
setEnd
(
connected
.
get
(
account
));
String
packetId
=
packet
.
getPacketID
();
try
{
ConnectionManager
.
getInstance
().
send
Packet
(
account
,
packet
);
ConnectionManager
.
getInstance
().
send
Stanza
(
account
,
packet
);
}
catch
(
NetworkException
e
)
{
}
return
packetId
;
...
...
@@ -722,7 +722,7 @@ public class MessageArchiveManager implements OnPacketListener,
modificationRequests
.
put
(
account
,
packet
.
getPacketID
(),
modification
);
try
{
if
(!
modification
)
{
ConnectionManager
.
getInstance
().
send
Packet
(
account
,
packet
);
ConnectionManager
.
getInstance
().
send
Stanza
(
account
,
packet
);
return
;
}
ConnectionManager
.
getInstance
().
sendRequest
(
account
,
packet
,
...
...
@@ -766,7 +766,7 @@ public class MessageArchiveManager implements OnPacketListener,
Pref
packet
=
new
Pref
();
packet
.
addItem
(
extension
);
packet
.
setType
(
Type
.
set
);
ConnectionManager
.
getInstance
().
send
Packet
(
account
,
packet
);
ConnectionManager
.
getInstance
().
send
Stanza
(
account
,
packet
);
}
private
void
sendItemRemove
(
String
account
,
String
user
)
...
...
@@ -776,7 +776,7 @@ public class MessageArchiveManager implements OnPacketListener,
ItemRemove
packet
=
new
ItemRemove
();
packet
.
addItem
(
extension
);
packet
.
setType
(
Type
.
set
);
ConnectionManager
.
getInstance
().
send
Packet
(
account
,
packet
);
ConnectionManager
.
getInstance
().
send
Stanza
(
account
,
packet
);
}
public
void
setOtrMode
(
String
account
,
String
user
,
OtrMode
otrMode
)
...
...
@@ -862,7 +862,7 @@ public class MessageArchiveManager implements OnPacketListener,
Pref
packet
=
new
Pref
();
packet
.
addSession
(
extension
);
packet
.
setType
(
Type
.
set
);
ConnectionManager
.
getInstance
().
send
Packet
(
account
,
packet
);
ConnectionManager
.
getInstance
().
send
Stanza
(
account
,
packet
);
sessionSaves
.
put
(
account
,
session
,
saveMode
);
}
...
...
@@ -873,7 +873,7 @@ public class MessageArchiveManager implements OnPacketListener,
SessionRemove
packet
=
new
SessionRemove
();
packet
.
addSession
(
extension
);
packet
.
setType
(
Type
.
set
);
ConnectionManager
.
getInstance
().
send
Packet
(
account
,
packet
);
ConnectionManager
.
getInstance
().
send
Stanza
(
account
,
packet
);
sessionSaves
.
remove
(
account
,
session
);
}
...
...
app/src/main/java/com/xabber/android/data/extension/attention/AttentionManager.java
View file @
4a1fae99
...
...
@@ -194,7 +194,7 @@ public class AttentionManager implements OnPacketListener, OnLoadListener {
message
.
setTo
(
to
);
message
.
setType
(
Message
.
Type
.
headline
);
message
.
addExtension
(
new
Attention
());
ConnectionManager
.
getInstance
().
send
Packet
(
account
,
message
);
ConnectionManager
.
getInstance
().
send
Stanza
(
account
,
message
);
chat
.
newAction
(
null
,
null
,
ChatAction
.
attention_called
);
}
...
...
app/src/main/java/com/xabber/android/data/extension/capability/CapabilitiesManager.java
View file @
4a1fae99
...
...
@@ -218,7 +218,7 @@ public class CapabilitiesManager implements OnAuthorizedListener,
if
(
capability
.
getNode
()
!=
null
&&
capability
.
getVersion
()
!=
null
)
packet
.
setNode
(
capability
.
getNode
()
+
"#"
+
capability
.
getVersion
());
try
{
ConnectionManager
.
getInstance
().
send
Packet
(
account
,
packet
);
ConnectionManager
.
getInstance
().
send
Stanza
(
account
,
packet
);
}
catch
(
NetworkException
e
)
{
return
;
}
...
...
app/src/main/java/com/xabber/android/data/extension/cs/ChatStateManager.java
View file @
4a1fae99
...
...
@@ -215,7 +215,7 @@ public class ChatStateManager implements OnDisconnectListener,
message
.
setTo
(
chat
.
getTo
());
message
.
addExtension
(
new
ChatStateExtension
(
chatState
));
try
{
ConnectionManager
.
getInstance
().
send
Packet
(
account
,
message
);
ConnectionManager
.
getInstance
().
send
Stanza
(
account
,
message
);
}
catch
(
NetworkException
e
)
{
// Just ignore it.
}
...
...
app/src/main/java/com/xabber/android/data/extension/muc/MUCManager.java
View file @
4a1fae99
...
...
@@ -39,7 +39,6 @@ import org.jivesoftware.smack.SmackException;
import
org.jivesoftware.smack.XMPPConnection
;
import
org.jivesoftware.smack.XMPPException
;
import
org.jivesoftware.smack.packet.Message
;
import
org.jivesoftware.smack.packet.Packet
;
import
org.jivesoftware.smack.packet.Stanza
;
import
org.jivesoftware.smackx.muc.MultiUserChat
;
import
org.jivesoftware.smackx.muc.MultiUserChatManager
;
...
...
@@ -442,7 +441,7 @@ public class MUCManager implements OnLoadListener, OnPacketListener {
invite
.
setReason
(
""
);
mucUser
.
setInvite
(
invite
);
message
.
addExtension
(
mucUser
);
ConnectionManager
.
getInstance
().
send
Packet
(
account
,
message
);
ConnectionManager
.
getInstance
().
send
Stanza
(
account
,
message
);
roomChat
.
putInvite
(
message
.
getPacketID
(),
user
);
roomChat
.
newAction
(
roomChat
.
getNickname
(),
user
,
ChatAction
.
invite_sent
);
}
...
...
app/src/main/java/com/xabber/android/data/extension/otr/OTRManager.java
View file @
4a1fae99
...
...
@@ -235,7 +235,7 @@ public class OTRManager implements OtrEngineHost, OtrEngineListener,
SSNManager
.
getInstance
().
setSessionOtrMode
(
account
,
user
,
abstractChat
.
getThreadId
(),
OtrMode
.
prefer
);
try
{
ConnectionManager
.
getInstance
()
.
send
Packet
(
abstractChat
.
getAccount
(),
abstractChat
.
createMessagePacket
(
msg
));
.
send
Stanza
(
abstractChat
.
getAccount
(),
abstractChat
.
createMessagePacket
(
msg
));
}
catch
(
NetworkException
e
)
{
throw
new
OtrException
(
e
);
}
...
...
app/src/main/java/com/xabber/android/data/extension/ping/PingManager.java
View file @
4a1fae99
...
...
@@ -69,7 +69,7 @@ public class PingManager implements OnPacketListener {
if
(
ping
.
getType
()
!=
IQ
.
Type
.
get
)
return
;
try
{
ConnectionManager
.
getInstance
().
send
Packet
(
account
,
ConnectionManager
.
getInstance
().
send
Stanza
(
account
,
IQ
.
createResultIQ
(
ping
));
}
catch
(
NetworkException
e
)
{
LogManager
.
exception
(
this
,
e
);
...
...
app/src/main/java/com/xabber/android/data/extension/ssn/SSNManager.java
View file @
4a1fae99
...
...
@@ -292,7 +292,7 @@ public class SSNManager implements OnPacketListener, OnAccountRemovedListener {
message
.
setThread
(
session
);
message
.
addExtension
(
feature
);
try
{
ConnectionManager
.
getInstance
().
send
Packet
(
account
,
message
);
ConnectionManager
.
getInstance
().
send
Stanza
(
account
,
message
);
}
catch
(
NetworkException
e
)
{
}
}
...
...
app/src/main/java/com/xabber/android/data/extension/time/TimeManager.java
View file @
4a1fae99
...
...
@@ -127,7 +127,7 @@ public class TimeManager implements OnServerInfoReceivedListener,
.
get
(
Calendar
.
DST_OFFSET
))
/
60000
);
result
.
setUtc
(
calendar
.
getTime
());
try
{
ConnectionManager
.
getInstance
().
send
Packet
(
account
,
result
);
ConnectionManager
.
getInstance
().
send
Stanza
(
account
,
result
);
}
catch
(
NetworkException
e
)
{
}
}
...
...
app/src/main/java/com/xabber/android/data/extension/vcard/VCardManager.java
View file @
4a1fae99
...
...
@@ -24,7 +24,6 @@ import java.util.Set;
import
org.jivesoftware.smack.packet.IQ
;
import
org.jivesoftware.smack.packet.IQ.Type
;
import
org.jivesoftware.smack.packet.Packet
;
import
org.jivesoftware.smack.packet.Presence
;
import
org.jivesoftware.smack.packet.Stanza
;
...
...
@@ -195,7 +194,7 @@ public class VCardManager implements OnLoadListener, OnPacketListener,
if
(
hash
!=
null
)
request
.
addHash
(
hash
);
try
{
ConnectionManager
.
getInstance
().
send
Packet
(
account
,
packet
);
ConnectionManager
.
getInstance
().
send
Stanza
(
account
,
packet
);
}
catch
(
NetworkException
e
)
{
requests
.
remove
(
request
);
onVCardFailed
(
account
,
bareAddress
);
...
...
app/src/main/java/com/xabber/android/data/message/AbstractChat.java
View file @
4a1fae99
...
...
@@ -34,7 +34,6 @@ import com.xabber.xmpp.carbon.CarbonManager;
import
org.jivesoftware.smack.packet.Message
;
import
org.jivesoftware.smack.packet.Message.Type
;
import
org.jivesoftware.smack.packet.Packet
;
import
org.jivesoftware.smack.packet.Stanza
;
import
org.jivesoftware.smack.util.StringUtils
;
import
org.jivesoftware.smackx.delay.packet.DelayInformation
;
...
...
@@ -583,7 +582,7 @@ public abstract class AbstractChat extends BaseEntity {
.
getTimestamp
()));
try
{
ConnectionManager
.
getInstance
()
.
send
Packet
(
account
,
message
);
.
send
Stanza
(
account
,
message
);
}
catch
(
NetworkException
e
)
{
break
;
}
...
...
app/src/main/java/com/xabber/android/data/message/ReceiptManager.java
View file @
4a1fae99
...
...
@@ -137,7 +137,7 @@ public class ReceiptManager implements OnPacketListener, OnDisconnectListener {
receipt
.
addExtension
(
new
Received
(
id
));
receipt
.
setThread
(
message
.
getThread
());
try
{
ConnectionManager
.
getInstance
().
send
Packet
(
account
,
ConnectionManager
.
getInstance
().
send
Stanza
(
account
,
receipt
);
}
catch
(
NetworkException
e
)
{
LogManager
.
exception
(
this
,
e
);
...
...
app/src/main/java/com/xabber/android/data/roster/PresenceManager.java
View file @
4a1fae99
...
...
@@ -124,7 +124,7 @@ public class PresenceManager implements OnArchiveModificationsReceivedListener,
throws
NetworkException
{
Presence
packet
=
new
Presence
(
Presence
.
Type
.
subscribe
);
packet
.
setTo
(
bareAddress
);
ConnectionManager
.
getInstance
().
send
Packet
(
account
,
packet
);
ConnectionManager
.
getInstance
().
send
Stanza
(
account
,
packet
);
HashSet
<
String
>
set
=
requestedSubscriptions
.
get
(
account
);
if
(
set
==
null
)
{
set
=
new
HashSet
<
String
>();
...
...
@@ -150,7 +150,7 @@ public class PresenceManager implements OnArchiveModificationsReceivedListener,
throws
NetworkException
{
Presence
packet
=
new
Presence
(
Presence
.
Type
.
subscribed
);
packet
.
setTo
(
bareAddress
);
ConnectionManager
.
getInstance
().
send
Packet
(
account
,
packet
);
ConnectionManager
.
getInstance
().
send
Stanza
(
account
,
packet
);
subscriptionRequestProvider
.
remove
(
account
,
bareAddress
);
removeRequestedSubscription
(
account
,
bareAddress
);
}
...
...
@@ -167,7 +167,7 @@ public class PresenceManager implements OnArchiveModificationsReceivedListener,
throws
NetworkException
{
Presence
packet
=
new
Presence
(
Presence
.
Type
.
unsubscribed
);
packet
.
setTo
(
bareAddress
);
ConnectionManager
.
getInstance
().
send
Packet
(
account
,
packet
);
ConnectionManager
.
getInstance
().
send
Stanza
(
account
,
packet
);
subscriptionRequestProvider
.
remove
(
account
,
bareAddress
);
removeRequestedSubscription
(
account
,
bareAddress
);
}
...
...
@@ -381,7 +381,7 @@ public class PresenceManager implements OnArchiveModificationsReceivedListener,
public
void
resendPresence
(
String
account
)
throws
NetworkException
{
if
(!
readyAccounts
.
contains
(
account
))
throw
new
NetworkException
(
R
.
string
.
NOT_CONNECTED
);
ConnectionManager
.
getInstance
().
send
Packet
(
account
,
ConnectionManager
.
getInstance
().
send
Stanza
(
account
,
AccountManager
.
getInstance
().
getAccount
(
account
).
getPresence
());
}
...
...
app/src/main/java/com/xabber/android/data/roster/RosterManager.java
View file @
4a1fae99
...
...
@@ -302,7 +302,7 @@ public class RosterManager implements OnDisconnectListener, OnPacketListener,
if
(
group
.
trim
().
length
()
>
0
)
item
.
addGroupName
(
group
);
packet
.
addRosterItem
(
item
);
ConnectionManager
.
getInstance
().
send
Packet
(
account
,
packet
);
ConnectionManager
.
getInstance
().
send
Stanza
(
account
,
packet
);
}
/**
...
...
@@ -319,7 +319,7 @@ public class RosterManager implements OnDisconnectListener, OnPacketListener,
RosterPacket
.
Item
item
=
new
RosterPacket
.
Item
(
bareAddress
,
""
);
item
.
setItemType
(
RosterPacket
.
ItemType
.
remove
);
packet
.
addRosterItem
(
item
);
ConnectionManager
.
getInstance
().
send
Packet
(
account
,
packet
);
ConnectionManager
.
getInstance
().
send
Stanza
(
account
,
packet
);
}
public
void
setGroups
(
String
account
,
String
bareAddress
,
Collection
<
String
>
groups
)
throws
NetworkException
{
...
...
@@ -357,7 +357,7 @@ public class RosterManager implements OnDisconnectListener, OnPacketListener,
item
.
addGroupName
(
group
);
}
packet
.
addRosterItem
(
item
);
ConnectionManager
.
getInstance
().
send
Packet
(
account
,
packet
);
ConnectionManager
.
getInstance
().
send
Stanza
(
account
,
packet
);
}
/**
...
...
@@ -384,7 +384,7 @@ public class RosterManager implements OnDisconnectListener, OnPacketListener,
}
if
(
packet
.
getRosterItemCount
()
==
0
)
return
;
ConnectionManager
.
getInstance
().
send
Packet
(
account
,
packet
);
ConnectionManager
.
getInstance
().
send
Stanza
(
account
,
packet
);
}
/**
...
...
@@ -439,7 +439,7 @@ public class RosterManager implements OnDisconnectListener, OnPacketListener,
}
if
(
packet
.
getRosterItemCount
()
==
0
)
return
;
ConnectionManager
.
getInstance
().
send
Packet
(
account
,
packet
);
ConnectionManager
.
getInstance
().
send
Stanza
(
account
,
packet
);
}
/**
...
...
@@ -500,7 +500,7 @@ public class RosterManager implements OnDisconnectListener, OnPacketListener,
String
account
=
((
AccountItem
)
connection
).
getAccount
();
requestedRosters
.
add
(
account
);
try
{
ConnectionManager
.
getInstance
().
send
Packet
(
account
,
ConnectionManager
.
getInstance
().
send
Stanza
(
account
,
new
RosterPacket
());
}
catch
(
NetworkException
e
)
{
LogManager
.
exception
(
this
,
e
);
...
...
app/src/main/java/com/xabber/xmpp/carbon/CarbonManager.java
View file @
4a1fae99
...
...
@@ -149,7 +149,7 @@ public class CarbonManager implements OnServerInfoReceivedListener, OnPacketList
// }
// }, new StanzaIdFilter(setIQ.getStanzaId()));
//
// connection.send
Packet
(setIQ);
// connection.send
Stanza
(setIQ);
}
/**
...
...
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