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
4198c098
Commit
4198c098
authored
Aug 10, 2015
by
Grigory Fedorov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
First implementation of MUC private chats.
parent
4070b26c
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
73 additions
and
12 deletions
+73
-12
MUCManager.java
...ava/com/xabber/android/data/extension/muc/MUCManager.java
+1
-1
RoomChat.java
.../java/com/xabber/android/data/extension/muc/RoomChat.java
+1
-1
VCardManager.java
...com/xabber/android/data/extension/vcard/VCardManager.java
+1
-1
MessageManager.java
.../java/com/xabber/android/data/message/MessageManager.java
+17
-3
RegularChat.java
...ain/java/com/xabber/android/data/message/RegularChat.java
+5
-2
ContactVcardViewerFragment.java
...ava/com/xabber/android/ui/ContactVcardViewerFragment.java
+19
-0
ContactViewer.java
app/src/main/java/com/xabber/android/ui/ContactViewer.java
+7
-2
OccupantList.java
app/src/main/java/com/xabber/android/ui/OccupantList.java
+17
-1
OccupantListAdapter.java
...va/com/xabber/android/ui/adapter/OccupantListAdapter.java
+1
-1
ContactTitleExpandableToolbarInflater.java
...roid/ui/helper/ContactTitleExpandableToolbarInflater.java
+4
-0
No files found.
app/src/main/java/com/xabber/android/data/extension/muc/MUCManager.java
View file @
4198c098
...
...
@@ -125,7 +125,7 @@ public class MUCManager implements OnLoadListener, OnPacketListener {
/**
* @return <code>null</code> if does not exists.
*/
p
rivate
RoomChat
getRoomChat
(
String
account
,
String
room
)
{
p
ublic
RoomChat
getRoomChat
(
String
account
,
String
room
)
{
AbstractChat
chat
=
MessageManager
.
getInstance
().
getChat
(
account
,
room
);
if
(
chat
!=
null
&&
chat
instanceof
RoomChat
)
{
return
(
RoomChat
)
chat
;
...
...
app/src/main/java/com/xabber/android/data/extension/muc/RoomChat.java
View file @
4198c098
...
...
@@ -153,7 +153,7 @@ public class RoomChat extends AbstractChat {
return
subject
;
}
MultiUserChat
getMultiUserChat
()
{
public
MultiUserChat
getMultiUserChat
()
{
return
multiUserChat
;
}
...
...
app/src/main/java/com/xabber/android/data/extension/vcard/VCardManager.java
View file @
4198c098
...
...
@@ -260,7 +260,7 @@ public class VCardManager implements OnLoadListener, OnPacketListener,
}
private
void
requestVCard
(
final
String
account
,
final
String
srcUser
)
{
final
String
user
=
Jid
.
getBareAddress
(
srcUser
)
;
final
String
user
=
srcUser
;
ConnectionThread
connectionThread
=
AccountManager
.
getInstance
().
getAccount
(
account
).
getConnectionThread
();
if
(
connectionThread
==
null
)
{
...
...
app/src/main/java/com/xabber/android/data/message/MessageManager.java
View file @
4198c098
...
...
@@ -36,6 +36,7 @@ import com.xabber.android.data.connection.OnPacketListener;
import
com.xabber.android.data.entity.BaseEntity
;
import
com.xabber.android.data.entity.NestedMap
;
import
com.xabber.android.data.extension.archive.MessageArchiveManager
;
import
com.xabber.android.data.extension.muc.MUCManager
;
import
com.xabber.android.data.extension.muc.RoomChat
;
import
com.xabber.android.data.roster.OnRosterReceivedListener
;
import
com.xabber.android.data.roster.OnStatusChangeListener
;
...
...
@@ -171,7 +172,7 @@ public class MessageManager implements OnLoadListener, OnPacketListener, OnDisco
* @return
*/
private
RegularChat
createChat
(
String
account
,
String
user
)
{
RegularChat
chat
=
new
RegularChat
(
account
,
Jid
.
getBareAddress
(
user
)
);
RegularChat
chat
=
new
RegularChat
(
account
,
user
);
addChat
(
chat
);
return
chat
;
}
...
...
@@ -477,10 +478,23 @@ public class MessageManager implements OnLoadListener, OnPacketListener, OnDisco
// archive have been received.
return
;
}
String
contact
=
bareAddress
;
if
(
packet
instanceof
Message
)
{
Message
message
=
(
Message
)
packet
;
if
(
MUCManager
.
getInstance
().
hasRoom
(
account
,
bareAddress
)
&&
message
.
getType
()
!=
Message
.
Type
.
groupchat
)
{
contact
=
packet
.
getFrom
();
}
}
final
String
user
=
packet
.
getFrom
();
boolean
processed
=
false
;
for
(
AbstractChat
chat
:
chats
.
getNested
(
account
).
values
())
{
if
(
chat
.
onPacket
(
bareAddress
,
packet
))
{
if
(
chat
.
onPacket
(
contact
,
packet
))
{
processed
=
true
;
break
;
}
...
...
@@ -499,7 +513,7 @@ public class MessageManager implements OnLoadListener, OnPacketListener, OnDisco
return
;
}
}
createChat
(
account
,
user
).
onPacket
(
bareAddress
,
packet
);
createChat
(
account
,
user
).
onPacket
(
contact
,
packet
);
}
}
...
...
app/src/main/java/com/xabber/android/data/message/RegularChat.java
View file @
4198c098
...
...
@@ -19,6 +19,7 @@ import com.xabber.android.data.NetworkException;
import
com.xabber.android.data.SettingsManager
;
import
com.xabber.android.data.SettingsManager.SecurityOtrMode
;
import
com.xabber.android.data.extension.archive.MessageArchiveManager
;
import
com.xabber.android.data.extension.muc.MUCManager
;
import
com.xabber.android.data.extension.otr.OTRManager
;
import
com.xabber.android.data.extension.otr.OTRUnencryptedException
;
import
com.xabber.android.data.extension.otr.SecurityLevel
;
...
...
@@ -58,10 +59,12 @@ public class RegularChat extends AbstractChat {
@Override
public
String
getTo
()
{
if
(
resource
==
null
)
if
(
resource
==
null
||
(
MUCManager
.
getInstance
().
hasRoom
(
account
,
Jid
.
getBareAddress
(
user
))
&&
getType
()
!=
Message
.
Type
.
groupchat
))
{
return
user
;
else
}
else
{
return
user
+
"/"
+
resource
;
}
}
@Override
...
...
app/src/main/java/com/xabber/android/ui/ContactVcardViewerFragment.java
View file @
4198c098
...
...
@@ -56,6 +56,11 @@ public class ContactVcardViewerFragment extends Fragment implements OnContactCha
private
VCard
vCard
;
private
boolean
vCardError
;
private
View
progressBar
;
private
Listener
listener
;
interface
Listener
{
void
onVCardReceived
();
}
public
static
ContactVcardViewerFragment
newInstance
(
String
account
,
String
user
)
{
ContactVcardViewerFragment
fragment
=
new
ContactVcardViewerFragment
();
...
...
@@ -67,6 +72,12 @@ public class ContactVcardViewerFragment extends Fragment implements OnContactCha
return
fragment
;
}
@Override
public
void
onAttach
(
Activity
activity
)
{
super
.
onAttach
(
activity
);
listener
=
(
Listener
)
activity
;
}
@Override
public
void
onCreate
(
Bundle
savedInstanceState
)
{
...
...
@@ -160,6 +171,13 @@ public class ContactVcardViewerFragment extends Fragment implements OnContactCha
}
}
@Override
public
void
onDetach
()
{
super
.
onDetach
();
listener
=
null
;
}
@Override
public
void
onVCardReceived
(
String
account
,
String
bareAddress
,
VCard
vCard
)
{
if
(!
this
.
account
.
equals
(
account
)
||
!
this
.
user
.
equals
(
bareAddress
))
{
...
...
@@ -168,6 +186,7 @@ public class ContactVcardViewerFragment extends Fragment implements OnContactCha
this
.
vCard
=
vCard
;
this
.
vCardError
=
false
;
updateVCard
();
listener
.
onVCardReceived
();
progressBar
.
setVisibility
(
View
.
GONE
);
}
...
...
app/src/main/java/com/xabber/android/ui/ContactViewer.java
View file @
4198c098
...
...
@@ -43,7 +43,7 @@ import java.util.Collection;
import
java.util.List
;
public
class
ContactViewer
extends
ManagedActivity
implements
OnContactChangedListener
,
OnAccountChangedListener
{
OnContactChangedListener
,
OnAccountChangedListener
,
ContactVcardViewerFragment
.
Listener
{
protected
ContactTitleExpandableToolbarInflater
contactTitleExpandableToolbarInflater
;
private
String
account
;
...
...
@@ -92,7 +92,7 @@ public class ContactViewer extends ManagedActivity implements
}
}
else
{
account
=
getAccount
(
getIntent
());
bareAddress
=
Jid
.
getBareAddress
(
getUser
(
getIntent
()
));
bareAddress
=
getUser
(
getIntent
(
));
}
if
(
bareAddress
!=
null
&&
bareAddress
.
equalsIgnoreCase
(
GroupManager
.
IS_ACCOUNT
))
{
...
...
@@ -170,4 +170,9 @@ public class ContactViewer extends ManagedActivity implements
protected
String
getBareAddress
()
{
return
bareAddress
;
}
@Override
public
void
onVCardReceived
()
{
contactTitleExpandableToolbarInflater
.
onResume
();
}
}
app/src/main/java/com/xabber/android/ui/OccupantList.java
View file @
4198c098
...
...
@@ -20,14 +20,17 @@ import android.os.Bundle;
import
android.support.v4.app.NavUtils
;
import
android.support.v7.widget.Toolbar
;
import
android.view.View
;
import
android.widget.AdapterView
;
import
com.xabber.android.R
;
import
com.xabber.android.data.Application
;
import
com.xabber.android.data.LogManager
;
import
com.xabber.android.data.account.OnAccountChangedListener
;
import
com.xabber.android.data.entity.BaseEntity
;
import
com.xabber.android.data.extension.muc.MUCManager
;
import
com.xabber.android.data.intent.AccountIntentBuilder
;
import
com.xabber.android.data.intent.EntityIntentBuilder
;
import
com.xabber.android.data.message.MessageManager
;
import
com.xabber.android.data.roster.OnContactChangedListener
;
import
com.xabber.android.ui.adapter.OccupantListAdapter
;
import
com.xabber.android.ui.helper.BarPainter
;
...
...
@@ -42,7 +45,7 @@ import java.util.Collection;
* @author alexander.ivanov
*/
public
class
OccupantList
extends
ManagedListActivity
implements
OnAccountChangedListener
,
OnContactChangedListener
{
OnAccountChangedListener
,
OnContactChangedListener
,
AdapterView
.
OnItemClickListener
{
private
String
account
;
private
String
room
;
...
...
@@ -92,6 +95,8 @@ public class OccupantList extends ManagedListActivity implements
listAdapter
=
new
OccupantListAdapter
(
this
,
account
,
room
);
setListAdapter
(
listAdapter
);
getListView
().
setOnItemClickListener
(
this
);
}
@Override
...
...
@@ -123,4 +128,15 @@ public class OccupantList extends ManagedListActivity implements
}
}
@Override
public
void
onItemClick
(
AdapterView
<?>
parent
,
View
view
,
int
position
,
long
id
)
{
com
.
xabber
.
android
.
data
.
extension
.
muc
.
Occupant
occupant
=
(
com
.
xabber
.
android
.
data
.
extension
.
muc
.
Occupant
)
listAdapter
.
getItem
(
position
);
LogManager
.
i
(
this
,
occupant
.
getNickname
());
String
occupantFullJid
=
room
+
"/"
+
occupant
.
getNickname
();
MessageManager
.
getInstance
().
openChat
(
account
,
occupantFullJid
);
startActivity
(
ChatViewer
.
createSpecificChatIntent
(
this
,
account
,
occupantFullJid
));
}
}
app/src/main/java/com/xabber/android/ui/adapter/OccupantListAdapter.java
View file @
4198c098
...
...
@@ -99,7 +99,7 @@ public class OccupantListAdapter extends BaseAdapter implements
.
getAccountAvatar
(
account
));
else
avatarView
.
setImageDrawable
(
AvatarManager
.
getInstance
()
.
get
OccupantAvatar
(
room
+
"/"
+
occupant
.
getNickname
()));
.
get
UserAvatarForContactList
(
room
+
"/"
+
occupant
.
getNickname
()));
affilationView
.
setImageLevel
(
occupant
.
getAffiliation
().
ordinal
());
nameView
.
setText
(
occupant
.
getNickname
());
int
textStyle
;
...
...
app/src/main/java/com/xabber/android/ui/helper/ContactTitleExpandableToolbarInflater.java
View file @
4198c098
...
...
@@ -100,6 +100,10 @@ public class ContactTitleExpandableToolbarInflater implements ObservableScrollVi
}
});
updateTitle
();
}
public
void
updateTitle
()
{
ContactTitleInflater
.
updateTitle
(
titleView
,
activity
,
abstractContact
);
}
...
...
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