aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/siacs
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2014-05-18 17:32:20 +0200
committerDaniel Gultsch <daniel@gultsch.de>2014-05-18 17:32:20 +0200
commit590e2403ab6d9d8f3b0158bf5218802216e9cd50 (patch)
tree717985d47b4dd9f98112618dba960ed5f078eb1e /src/eu/siacs
parente857cf979d719d18b0d0a858413ceeb0a4ef5305 (diff)
bind and session request more compatible
Diffstat (limited to '')
-rw-r--r--src/eu/siacs/conversations/entities/Message.java1
-rw-r--r--src/eu/siacs/conversations/ui/ConversationActivity.java7
-rw-r--r--src/eu/siacs/conversations/xmpp/XmppConnection.java15
3 files changed, 19 insertions, 4 deletions
diff --git a/src/eu/siacs/conversations/entities/Message.java b/src/eu/siacs/conversations/entities/Message.java
index 33f7a8d49..950e349e0 100644
--- a/src/eu/siacs/conversations/entities/Message.java
+++ b/src/eu/siacs/conversations/entities/Message.java
@@ -29,6 +29,7 @@ public class Message extends AbstractEntity {
public static final int TYPE_TEXT = 0;
public static final int TYPE_IMAGE = 1;
+ public static final int TYPE_AUDIO = 2;
public static String CONVERSATION = "conversationUuid";
public static String COUNTERPART = "counterpart";
diff --git a/src/eu/siacs/conversations/ui/ConversationActivity.java b/src/eu/siacs/conversations/ui/ConversationActivity.java
index 59c47fcf0..c3626ee11 100644
--- a/src/eu/siacs/conversations/ui/ConversationActivity.java
+++ b/src/eu/siacs/conversations/ui/ConversationActivity.java
@@ -722,12 +722,19 @@ public class ConversationActivity extends XmppActivity {
encryptTextMessage();
} else if (requestCode == REQUEST_IMAGE_CAPTURE) {
attachImageToConversation(getSelectedConversation(), null);
+ } else if (requestCode == REQUEST_RECORD_AUDIO) {
+ Log.d("xmppService",data.getData().toString());
+ attachAudioToConversation(getSelectedConversation(),data.getData());
} else {
Log.d(LOGTAG,"unknown result code:"+requestCode);
}
}
}
+ private void attachAudioToConversation(Conversation conversation, Uri uri) {
+
+ }
+
private void attachImageToConversation(Conversation conversation, Uri uri) {
prepareImageToast = Toast.makeText(getApplicationContext(), getText(R.string.preparing_image), Toast.LENGTH_LONG);
prepareImageToast.show();
diff --git a/src/eu/siacs/conversations/xmpp/XmppConnection.java b/src/eu/siacs/conversations/xmpp/XmppConnection.java
index f7f25dcc3..58e110d6d 100644
--- a/src/eu/siacs/conversations/xmpp/XmppConnection.java
+++ b/src/eu/siacs/conversations/xmpp/XmppConnection.java
@@ -617,7 +617,7 @@ public class XmppConnection implements Runnable {
private void sendBindRequest() throws IOException {
IqPacket iq = new IqPacket(IqPacket.TYPE_SET);
iq.addChild("bind", "urn:ietf:params:xml:ns:xmpp-bind").addChild("resource").setContent(account.getResource());
- this.sendIqPacket(iq, new OnIqPacketReceived() {
+ this.sendUnboundIqPacket(iq, new OnIqPacketReceived() {
@Override
public void onIqPacketReceived(Account account, IqPacket packet) {
String resource = packet.findChild("bind").findChild("jid")
@@ -644,9 +644,8 @@ public class XmppConnection implements Runnable {
if (this.streamFeatures.hasChild("session")) {
Log.d(LOGTAG,account.getJid()+": sending deprecated session");
IqPacket startSession = new IqPacket(IqPacket.TYPE_SET);
- startSession.addChild("session","urn:ietf:params:xml:ns:xmpp-session"); //setContent("")
- startSession.setId(nextRandomId());
- this.sendPacket(startSession, null);
+ startSession.addChild("session","urn:ietf:params:xml:ns:xmpp-session");
+ this.sendUnboundIqPacket(startSession, null);
}
}
@@ -746,6 +745,14 @@ public class XmppConnection implements Runnable {
packet.setFrom(account.getFullJid());
this.sendPacket(packet, callback);
}
+
+ public void sendUnboundIqPacket(IqPacket packet, OnIqPacketReceived callback) {
+ if (packet.getId()==null) {
+ String id = nextRandomId();
+ packet.setAttribute("id", id);
+ }
+ this.sendPacket(packet, callback);
+ }
public void sendMessagePacket(MessagePacket packet) {
this.sendPacket(packet, null);