mirror of
https://github.com/moparisthebest/Conversations
synced 2024-12-26 01:09:13 -05:00
send messages in mucs are no longer displayed twice
This commit is contained in:
parent
c31101dd64
commit
4a963d6f50
@ -194,9 +194,9 @@ public class XmppConnectionService extends Service {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void sendMessage(final Account account, final Message message) {
|
public void sendMessage(final Account account, final Message message) {
|
||||||
Log.d(LOGTAG, "sending message for " + account.getJid() + " to: "
|
if (message.getConversation().getMode()==Conversation.MODE_SINGLE) {
|
||||||
+ message.getCounterpart());
|
|
||||||
databaseBackend.createMessage(message);
|
databaseBackend.createMessage(message);
|
||||||
|
}
|
||||||
MessagePacket packet = new MessagePacket();
|
MessagePacket packet = new MessagePacket();
|
||||||
if (message.getConversation().getMode() == Conversation.MODE_SINGLE) {
|
if (message.getConversation().getMode() == Conversation.MODE_SINGLE) {
|
||||||
packet.setType(MessagePacket.TYPE_CHAT);
|
packet.setType(MessagePacket.TYPE_CHAT);
|
||||||
@ -208,10 +208,12 @@ public class XmppConnectionService extends Service {
|
|||||||
packet.setBody(message.getBody());
|
packet.setBody(message.getBody());
|
||||||
if (account.getStatus()==Account.STATUS_ONLINE) {
|
if (account.getStatus()==Account.STATUS_ONLINE) {
|
||||||
connections.get(account).sendMessagePacket(packet);
|
connections.get(account).sendMessagePacket(packet);
|
||||||
|
if (message.getConversation().getMode()==Conversation.MODE_SINGLE) {
|
||||||
message.setStatus(Message.STATUS_SEND);
|
message.setStatus(Message.STATUS_SEND);
|
||||||
databaseBackend.updateMessage(message);
|
databaseBackend.updateMessage(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void getRoster(Account account,
|
public void getRoster(Account account,
|
||||||
final OnRosterFetchedListener listener) {
|
final OnRosterFetchedListener listener) {
|
||||||
|
@ -56,10 +56,10 @@ public class ConversationFragment extends Fragment {
|
|||||||
Message message = new Message(conversation, chatMsg
|
Message message = new Message(conversation, chatMsg
|
||||||
.getText().toString(), Message.ENCRYPTION_NONE);
|
.getText().toString(), Message.ENCRYPTION_NONE);
|
||||||
activity.xmppConnectionService.sendMessage(conversation.getAccount(),message);
|
activity.xmppConnectionService.sendMessage(conversation.getAccount(),message);
|
||||||
conversation.getMessages().add(message);
|
|
||||||
chatMsg.setText("");
|
chatMsg.setText("");
|
||||||
|
|
||||||
if (conversation.getMode()==Conversation.MODE_SINGLE) {
|
if (conversation.getMode()==Conversation.MODE_SINGLE) {
|
||||||
|
conversation.getMessages().add(message);
|
||||||
messageList.add(message);
|
messageList.add(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user