# HG changeset patch # User marseille@KungFuh # Date 1239141727 -7200 # Node ID 3f6eb92339879d7ed2c12873c7062835f3b5a90e # Parent 7b2a869e9ef89312a03ca5931cff88a80eda4484# Parent 2e6e98e9f8efdae62104e7220d2539d7626a2cd3 merge. diff -r 7b2a869e9ef8 -r 3f6eb9233987 src/com/beem/project/beem/service/Contact.java --- a/src/com/beem/project/beem/service/Contact.java Wed Apr 08 00:01:39 2009 +0200 +++ b/src/com/beem/project/beem/service/Contact.java Wed Apr 08 00:02:07 2009 +0200 @@ -20,12 +20,36 @@ */ public class Contact implements Parcelable { + /** + * Status of a disconnected contact. + */ public static final int CONTACT_STATUS_DISCONNECT = 100; + + /** + * Status of a unavailable (long away) contact. + */ public static final int CONTACT_STATUS_UNAVAILABLE = 200; + + /** + * Status of a away contact. + */ public static final int CONTACT_STATUS_AWAY = 300; + + /** + * Status of a busy contact. + */ public static final int CONTACT_STATUS_BUSY = 400; + + /** + * Status of a available contact. + */ public static final int CONTACT_STATUS_AVAILABLE = 500; + + /** + * Status of a available for chat contact. + */ public static final int CONTACT_STATUS_AVAILABLE_FOR_CHAT = 600; + private static final String TAG = "Contact"; private int mID; @@ -51,9 +75,26 @@ }; /** + * Constructor. + */ + public Contact() { + // TODO Auto-generated constructor stub + } + + /** + * Constructor. + * @param jid JID of the contact + */ + public Contact(final String jid) { + mJID = jid; + mStatus = Contact.CONTACT_STATUS_DISCONNECT; + mRes = new ArrayList(); + mRes.add("none"); + } + + /** * Construct a contact from a parcel. - * @param in - * parcel to use for construction + * @param in parcel to use for construction */ private Contact(final Parcel in) { mID = in.readInt(); @@ -86,25 +127,7 @@ } /** - * Constructor. - */ - public Contact() { - // TODO Auto-generated constructor stub - } - - /** - * Constructor. - * @param jid - * JID of the contact - */ - public Contact(final String jid) { - mJID = jid; - mStatus = Contact.CONTACT_STATUS_DISCONNECT; - mRes = new ArrayList(); - mRes.add("none"); - } - - /** + * Get the id of the contact on the phone contact list. * @return the mID */ public int getID() { @@ -112,14 +135,15 @@ } /** - * @param mid - * the mID to set + * set the id of te contact on the phone contact list. + * @param mid the mID to set */ public void setID(int mid) { mID = mid; } /** + * Get the status of the contact. * @return the mStatus */ public int getStatus() { @@ -127,63 +151,71 @@ } /** - * @param status - * the mStatus to set + * Set the status of the contact. + * @param status the mStatus to set */ public void setStatus(int status) { mStatus = status; } /** - * @param presence - * the presence containing status + * Set the status of the contact using a presence packet. + * @param presence the presence containing status */ public void setStatus(Presence presence) { - Log.i(TAG, "NIKITAAAA"); - /* presence.isAvailable() !?!? */ - if (presence.getType().equals(Presence.Type.available)) { - mStatus = Contact.CONTACT_STATUS_AVAILABLE; + if (presence.getType().equals(Presence.Type.unavailable)) { + Log.d(TAG, "Presence pas dispo"); + mStatus = Contact.CONTACT_STATUS_DISCONNECT; + } else { Log.d(TAG, "Presence OK"); Mode mode = presence.getMode(); - switch (mode) { - case available: - mStatus = Contact.CONTACT_STATUS_AVAILABLE; - break; - case away: - mStatus = Contact.CONTACT_STATUS_AWAY; - break; - case chat: - mStatus = Contact.CONTACT_STATUS_AVAILABLE_FOR_CHAT; + if (mode == null) { + mStatus = Contact.CONTACT_STATUS_AVAILABLE; + } + else { + switch (mode) { + case available: + Log.d(TAG, "Available"); + mStatus = Contact.CONTACT_STATUS_AVAILABLE; + break; + case away: + Log.d(TAG, "Away"); + mStatus = Contact.CONTACT_STATUS_AWAY; + break; + case chat: + Log.d(TAG, "Chat"); + mStatus = Contact.CONTACT_STATUS_AVAILABLE_FOR_CHAT; + break; + case dnd: + Log.d(TAG, "Dnd"); + mStatus = Contact.CONTACT_STATUS_BUSY; + break; + case xa: + Log.d(TAG, "Xa"); + mStatus = Contact.CONTACT_STATUS_UNAVAILABLE; + break; + default: + Log.d(TAG, "Status mode non gere"); + mStatus = Contact.CONTACT_STATUS_DISCONNECT; break; - case dnd: - mStatus = Contact.CONTACT_STATUS_BUSY; - break; - case xa: - mStatus = Contact.CONTACT_STATUS_UNAVAILABLE; - break; - default: - Log.e("RosterAdapter", "Status mode non gere"); - mStatus = Contact.CONTACT_STATUS_AVAILABLE; - break; + } } - } else { - Log.d(TAG, "Presence pas dispo"); - mStatus = Contact.CONTACT_STATUS_DISCONNECT; } } /** - * @return the mMsgState + * Get the message status of the contact. + * @return the message status of the contact. */ - public String getMMsgState() { + public String getMsgState() { return mMsgState; } /** - * @param msgState - * the mMsgState to set + * Set the message status of the contact. + * @param msgState the message status of the contact to set */ - public void setMMsgState(String msgState) { + public void setMsgState(String msgState) { mMsgState = msgState; } @@ -197,25 +229,31 @@ /** * Set the Jabber ID of the contact. - * @param mjid - * the jabber ID to set + * @param mjid the jabber ID to set */ public void setJID(String mjid) { mJID = mjid; } + /** + * + * @param res + */ public void addRes(String res) { if (!mRes.contains(res)) mRes.add(res); } + /** + * + * @param res + */ public void delRes(String res) { mRes.remove(res); } /** - * @param mRes - * the mRes to set + * @param mRes the mRes to set */ public void setMRes(List mRes) { this.mRes = mRes; diff -r 7b2a869e9ef8 -r 3f6eb9233987 src/com/beem/project/beem/ui/ContactList.java --- a/src/com/beem/project/beem/ui/ContactList.java Wed Apr 08 00:01:39 2009 +0200 +++ b/src/com/beem/project/beem/ui/ContactList.java Wed Apr 08 00:02:07 2009 +0200 @@ -283,7 +283,7 @@ v = (TextView) view.findViewById(to[2]); if (v != null) { - v.setText(c.getMMsgState()); + v.setText(c.getMsgState()); } /*