aboutsummaryrefslogtreecommitdiffstats
path: root/src/de/gultsch
diff options
context:
space:
mode:
Diffstat (limited to 'src/de/gultsch')
-rw-r--r--src/de/gultsch/chat/services/XmppConnectionService.java12
-rw-r--r--src/de/gultsch/chat/ui/ConversationFragment.java2
2 files changed, 8 insertions, 6 deletions
diff --git a/src/de/gultsch/chat/services/XmppConnectionService.java b/src/de/gultsch/chat/services/XmppConnectionService.java
index 3a316fbb..0a189492 100644
--- a/src/de/gultsch/chat/services/XmppConnectionService.java
+++ b/src/de/gultsch/chat/services/XmppConnectionService.java
@@ -194,9 +194,9 @@ public class XmppConnectionService extends Service {
}
public void sendMessage(final Account account, final Message message) {
- Log.d(LOGTAG, "sending message for " + account.getJid() + " to: "
- + message.getCounterpart());
- databaseBackend.createMessage(message);
+ if (message.getConversation().getMode()==Conversation.MODE_SINGLE) {
+ databaseBackend.createMessage(message);
+ }
MessagePacket packet = new MessagePacket();
if (message.getConversation().getMode() == Conversation.MODE_SINGLE) {
packet.setType(MessagePacket.TYPE_CHAT);
@@ -208,8 +208,10 @@ public class XmppConnectionService extends Service {
packet.setBody(message.getBody());
if (account.getStatus()==Account.STATUS_ONLINE) {
connections.get(account).sendMessagePacket(packet);
- message.setStatus(Message.STATUS_SEND);
- databaseBackend.updateMessage(message);
+ if (message.getConversation().getMode()==Conversation.MODE_SINGLE) {
+ message.setStatus(Message.STATUS_SEND);
+ databaseBackend.updateMessage(message);
+ }
}
}
diff --git a/src/de/gultsch/chat/ui/ConversationFragment.java b/src/de/gultsch/chat/ui/ConversationFragment.java
index 2da0940b..13e617fd 100644
--- a/src/de/gultsch/chat/ui/ConversationFragment.java
+++ b/src/de/gultsch/chat/ui/ConversationFragment.java
@@ -56,10 +56,10 @@ public class ConversationFragment extends Fragment {
Message message = new Message(conversation, chatMsg
.getText().toString(), Message.ENCRYPTION_NONE);
activity.xmppConnectionService.sendMessage(conversation.getAccount(),message);
- conversation.getMessages().add(message);
chatMsg.setText("");
if (conversation.getMode()==Conversation.MODE_SINGLE) {
+ conversation.getMessages().add(message);
messageList.add(message);
}