src/com/beem/project/beem/service/XmppConnectionAdapter.java
changeset 530 25f834f8c264
parent 526 62a448d5dfe9
child 532 58a827799e79
--- a/src/com/beem/project/beem/service/XmppConnectionAdapter.java	Tue Nov 17 00:29:37 2009 +0100
+++ b/src/com/beem/project/beem/service/XmppConnectionAdapter.java	Tue Nov 17 00:43:27 2009 +0100
@@ -174,20 +174,23 @@
     @Override
     public void changeStatusAndPriority(int status, String msg, int priority) {
 	Presence pres = new Presence(Presence.Type.available);
+	String m;
 	if (msg != null)
-	    pres.setStatus(msg);
+	    m = msg;
 	else
-	    msg = "";
+	    m = "";
+	pres.setStatus(m);
 	Presence.Mode mode = Status.getPresenceModeFromStatus(status);
 	if (mode != null)
 	    pres.setMode(mode);
 	// Smack limit : Priority between -128 and 128
-	if (priority < -128) priority = -128;
-	if (priority > 128) priority = 128;
-	mPreviousPriority = priority;
-	pres.setPriority(priority);
+	int p = priority;
+	if (priority < -128) p = -128;
+	if (priority > 128) p = 128;
+	mPreviousPriority = p;
+	pres.setPriority(p);
 	mAdaptee.sendPacket(pres);
-	updateNotification(msg);
+	updateNotification(m);
     }
 
     /**
@@ -196,10 +199,12 @@
     @Override
     public void changeStatus(int status, String msg) {
 	Presence pres = new Presence(Presence.Type.available);
+	String m;
 	if (msg != null)
-	    pres.setStatus(msg);
+	    m = msg;
 	else
-	    msg = "";
+	    m = "";
+	pres.setStatus(m);
 	Presence.Mode mode = Status.getPresenceModeFromStatus(status);
 	if (mode != null)
 	    pres.setMode(mode);
@@ -208,6 +213,10 @@
 	updateNotification(msg);
     }
 
+    /**
+     * Update the notification for the Beem status.
+     * @param text the text to display.
+     */
     private void updateNotification(String text) {
  	Notification mStatusNotification;
 	mStatusNotification = new Notification(com.beem.project.beem.R.drawable.beem_status_icon, text, System
@@ -218,7 +227,7 @@
 	mStatusNotification.setLatestEventInfo(mService, "Beem Status", text, PendingIntent.getActivity(
 	    mService, 0, new Intent(mService, ChangeStatus.class), 0));
 	mService.sendNotification(BeemService.NOTIFICATION_STATUS_ID, mStatusNotification);
-   
+
     }
 
     /**