--- a/src/com/beem/project/beem/service/ChatAdapter.java Thu Apr 23 15:37:24 2009 +0200
+++ b/src/com/beem/project/beem/service/ChatAdapter.java Thu Apr 23 20:25:17 2009 +0200
@@ -4,16 +4,11 @@
package com.beem.project.beem.service;
import org.jivesoftware.smack.Chat;
-import org.jivesoftware.smack.MessageListener;
import org.jivesoftware.smack.XMPPException;
-import org.jivesoftware.smack.packet.Message;
-import android.os.RemoteCallbackList;
import android.os.RemoteException;
-import android.util.Log;
import com.beem.project.beem.service.aidl.IChat;
-import com.beem.project.beem.service.aidl.IMessageListener;
/**
* An adapter for smack's Chat class.
--- a/src/com/beem/project/beem/service/Contact.java Thu Apr 23 15:37:24 2009 +0200
+++ b/src/com/beem/project/beem/service/Contact.java Thu Apr 23 20:25:17 2009 +0200
@@ -7,7 +7,6 @@
import java.util.List;
import org.jivesoftware.smack.packet.Presence;
-import org.jivesoftware.smack.packet.Presence.Mode;
import com.beem.project.beem.utils.Status;
--- a/src/com/beem/project/beem/service/PresenceAdapter.java Thu Apr 23 15:37:24 2009 +0200
+++ b/src/com/beem/project/beem/service/PresenceAdapter.java Thu Apr 23 20:25:17 2009 +0200
@@ -2,13 +2,17 @@
import org.jivesoftware.smack.packet.Presence;
-import android.os.IBinder;
+import com.beem.project.beem.utils.PresenceType;
+import com.beem.project.beem.utils.Status;
+
import android.os.Parcel;
import android.os.Parcelable;
public class PresenceAdapter implements Parcelable {
- private Presence mPresence;
+ private int mType;
+ private int mStatus;
+ private String mTo;
/**
* Parcelable.Creator needs by Android.
@@ -27,12 +31,16 @@
};
public PresenceAdapter(Presence presence) {
- mPresence = presence;
+ mType = PresenceType.getPresenceType(presence);
+ mStatus = Status.getStatusFromPresence(presence);
+ mTo = presence.getTo();
}
public PresenceAdapter(Parcel source) {
- // TODO Auto-generated constructor stub
+ mType = source.readInt();
+ mStatus = source.readInt();
+ mTo = source.readString();
}
@Override
@@ -43,7 +51,55 @@
@Override
public void writeToParcel(Parcel dest, int flags) {
- // TODO Auto-generated method stub
-
+ dest.writeInt(mType);
+ dest.writeInt(mStatus);
+ dest.writeString(mTo);
+ }
+
+
+ /**
+ * @param mStatus the mStatus to set
+ */
+ public void setStatus(int mStatus) {
+ this.mStatus = mStatus;
+ }
+
+
+ /**
+ * @return the mStatus
+ */
+ public int getStatus() {
+ return mStatus;
+ }
+
+
+ /**
+ * @param mType the mType to set
+ */
+ public void setType(int mType) {
+ this.mType = mType;
+ }
+
+
+ /**
+ * @return the mType
+ */
+ public int getType() {
+ return mType;
+ }
+
+
+ /**
+ * @param mTo the mTo to set
+ */
+ public void setTo(String mTo) {
+ this.mTo = mTo;
+ }
+
+ /**
+ * @return the mTo
+ */
+ public String getTo() {
+ return mTo;
}
}
--- a/src/com/beem/project/beem/service/RosterAdapter.java Thu Apr 23 15:37:24 2009 +0200
+++ b/src/com/beem/project/beem/service/RosterAdapter.java Thu Apr 23 20:25:17 2009 +0200
@@ -15,8 +15,11 @@
import org.jivesoftware.smack.RosterListener;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.packet.Presence;
+import org.jivesoftware.smack.packet.Presence.Type;
import org.jivesoftware.smack.util.StringUtils;
+import com.beem.project.beem.BeemApplication;
+import com.beem.project.beem.BeemService;
import com.beem.project.beem.service.aidl.IBeemRosterListener;
import android.os.RemoteCallbackList;
--- a/src/com/beem/project/beem/service/XmppConnectionAdapter.java Thu Apr 23 15:37:24 2009 +0200
+++ b/src/com/beem/project/beem/service/XmppConnectionAdapter.java Thu Apr 23 20:25:17 2009 +0200
@@ -4,19 +4,16 @@
package com.beem.project.beem.service;
import org.jivesoftware.smack.ConnectionConfiguration;
-import org.jivesoftware.smack.ConnectionCreationListener;
import org.jivesoftware.smack.ConnectionListener;
import org.jivesoftware.smack.Roster;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;
-import org.jivesoftware.smack.packet.XMPPError;
import org.jivesoftware.smackx.ChatStateManager;
import org.jivesoftware.smackx.ServiceDiscoveryManager;
import org.jivesoftware.smackx.jingle.JingleManager;
import android.os.RemoteCallbackList;
import android.os.RemoteException;
import android.util.Log;
-import com.beem.project.beem.BeemException;
import com.beem.project.beem.BeemService;
import com.beem.project.beem.service.aidl.IBeemConnectionListener;
import com.beem.project.beem.service.aidl.IChatManager;
@@ -35,7 +32,6 @@
private String mLogin;
private String mPassword;
private RosterAdapter mRoster;
- private Object mLastException;
private BeemService mService;
private RemoteCallbackList<IBeemConnectionListener> mRemoteConnListeners = new RemoteCallbackList<IBeemConnectionListener>();
@@ -88,7 +84,6 @@
// TODO find why this cause a null pointer exception
this.initFeatures(); // pour declarer les features xmpp qu'on supporte
ChatStateManager.getInstance(mAdaptee);
- mLastException = null;
triggerAsynchronousConnectEvent();
return true;
} catch (XMPPException e) {
@@ -104,7 +99,6 @@
@Override
public boolean disconnect() {
mAdaptee.disconnect();
- mLastException = null;
return true;
}
--- a/src/com/beem/project/beem/service/XmppFacade.java Thu Apr 23 15:37:24 2009 +0200
+++ b/src/com/beem/project/beem/service/XmppFacade.java Thu Apr 23 20:25:17 2009 +0200
@@ -5,7 +5,6 @@
import android.app.Notification;
import android.app.PendingIntent;
import android.content.Intent;
-import android.graphics.Bitmap.CompressFormat;
import android.os.RemoteException;
import com.beem.project.beem.BeemService;
@@ -14,6 +13,7 @@
import com.beem.project.beem.service.aidl.IXmppConnection;
import com.beem.project.beem.service.aidl.IXmppFacade;
import com.beem.project.beem.ui.ChangeStatus;
+import com.beem.project.beem.utils.PresenceType;
/**
* This class is a facade for the Beem Service.
@@ -101,10 +101,16 @@
mStatusNotification.defaults = Notification.DEFAULT_ALL;
mStatusNotification.flags = Notification.FLAG_NO_CLEAR;
- // TODO
// mStatusNotification.contentView = ;
mStatusNotification.setLatestEventInfo(mBeemService, "Beem Status", text, PendingIntent.getActivity(
mBeemService, 0, new Intent(mBeemService,ChangeStatus.class), 0));
mBeemService.sendNotification(BeemService.NOTIFICATION_STATUS_ID, mStatusNotification);
}
+
+ @Override
+ public void sendPresencePacket(PresenceAdapter presence) throws RemoteException {
+ Presence presence2 = new Presence(PresenceType.getPresenceTypeFrom(presence.getType()));
+ presence2.setTo(presence.getTo());
+ mConnexion.getAdaptee().sendPacket(presence2);
+ }
}
--- a/src/com/beem/project/beem/service/aidl/IXmppFacade.aidl Thu Apr 23 15:37:24 2009 +0200
+++ b/src/com/beem/project/beem/service/aidl/IXmppFacade.aidl Thu Apr 23 20:25:17 2009 +0200
@@ -3,6 +3,7 @@
import com.beem.project.beem.service.aidl.IXmppConnection;
import com.beem.project.beem.service.aidl.IRoster;