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
c6bc9ed0
Commit
c6bc9ed0
authored
Jul 15, 2015
by
Grigory Fedorov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Smack: MUCManager and RoomChat migration completed. #502
parent
e3b0f3d2
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
23 deletions
+25
-23
MUCManager.java
...ava/com/xabber/android/data/extension/muc/MUCManager.java
+10
-7
RoomChat.java
.../java/com/xabber/android/data/extension/muc/RoomChat.java
+15
-16
No files found.
app/src/main/java/com/xabber/android/data/extension/muc/MUCManager.java
View file @
c6bc9ed0
...
...
@@ -40,6 +40,7 @@ import org.jivesoftware.smack.XMPPConnection;
import
org.jivesoftware.smack.XMPPException
;
import
org.jivesoftware.smack.packet.Message
;
import
org.jivesoftware.smack.packet.Stanza
;
import
org.jivesoftware.smack.packet.XMPPError
;
import
org.jivesoftware.smackx.muc.MultiUserChat
;
import
org.jivesoftware.smackx.muc.MultiUserChatManager
;
import
org.jivesoftware.smackx.muc.packet.MUCUser
;
...
...
@@ -335,13 +336,15 @@ public class MUCManager implements OnLoadListener, OnPacketListener {
roomChat
.
setState
(
RoomState
.
error
);
addAuthorizationError
(
account
,
room
);
// if (e.getXMPPError() != null && e.getXMPPError().getCode() == 409) {
// Application.getInstance().onError(R.string.NICK_ALREADY_USED);
// } else if (e.getXMPPError() != null && e.getXMPPError().getCode() == 401) {
// Application.getInstance().onError(R.string.AUTHENTICATION_FAILED);
// } else {
// Application.getInstance().onError(R.string.NOT_CONNECTED);
// }
XMPPError
xmppError
=
e
.
getXMPPError
();
if
(
xmppError
!=
null
&&
xmppError
.
getCondition
()
==
XMPPError
.
Condition
.
conflict
)
{
Application
.
getInstance
().
onError
(
R
.
string
.
NICK_ALREADY_USED
);
}
else
if
(
xmppError
!=
null
&&
xmppError
.
getCondition
()
==
XMPPError
.
Condition
.
not_authorized
)
{
Application
.
getInstance
().
onError
(
R
.
string
.
AUTHENTICATION_FAILED
);
}
else
{
Application
.
getInstance
().
onError
(
R
.
string
.
NOT_CONNECTED
);
}
RosterManager
.
getInstance
().
onContactChanged
(
account
,
room
);
}
});
...
...
app/src/main/java/com/xabber/android/data/extension/muc/RoomChat.java
View file @
c6bc9ed0
...
...
@@ -279,22 +279,21 @@ public class RoomChat extends AbstractChat {
occupants
.
remove
(
stringPrep
);
MUCUser
mucUser
=
MUC
.
getMUCUserExtension
(
presence
);
if
(
mucUser
!=
null
&&
mucUser
.
getStatus
()
!=
null
)
{
// String code = mucUser.getStatus().getCode();
// if ("307".equals(code)) {
// onKick(resource, mucUser.getItem().getActor());
// } else if ("301".equals(code)) {
// onBan(resource, mucUser.getItem().getActor());
// } else if ("303".equals(code)) {
// String newNick = mucUser.getItem().getNick();
// if (newNick == null) {
// return true;
// }
// onRename(resource, newNick);
// Occupant occupant = createOccupant(newNick, presence);
// occupants.put(Jid.getStringPrep(newNick), occupant);
// } else if ("321".equals(code)) {
// onRevoke(resource, mucUser.getItem().getActor());
// }
if
(
mucUser
.
getStatus
().
contains
(
MUCUser
.
Status
.
KICKED_307
))
{
onKick
(
resource
,
mucUser
.
getItem
().
getActor
());
}
else
if
(
mucUser
.
getStatus
().
contains
(
MUCUser
.
Status
.
BANNED_301
)){
onBan
(
resource
,
mucUser
.
getItem
().
getActor
());
}
else
if
(
mucUser
.
getStatus
().
contains
(
MUCUser
.
Status
.
NEW_NICKNAME_303
))
{
String
newNick
=
mucUser
.
getItem
().
getNick
();
if
(
newNick
==
null
)
{
return
true
;
}
onRename
(
resource
,
newNick
);
Occupant
occupant
=
createOccupant
(
newNick
,
presence
);
occupants
.
put
(
Jid
.
getStringPrep
(
newNick
),
occupant
);
}
else
if
(
mucUser
.
getStatus
().
contains
(
MUCUser
.
Status
.
REMOVED_AFFIL_CHANGE_321
))
{
onRevoke
(
resource
,
mucUser
.
getItem
().
getActor
());
}
}
else
{
onLeave
(
resource
);
}
...
...
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