diff -wBNru xmppframework-orig/contrib/xmpp_api/vendor/XMPPHP/Log.php xmppframework-mod/contrib/xmpp_api/vendor/XMPPHP/Log.php
--- xmppframework-orig/contrib/xmpp_api/vendor/XMPPHP/Log.php	2009-08-27 17:46:41.000000000 -0400
+++ xmppframework-mod/contrib/xmpp_api/vendor/XMPPHP/Log.php	2010-03-30 00:38:44.000000000 -0400
@@ -111,6 +111,7 @@
 	
 	protected function writeLine($msg, $runlevel, $time) {
 		//echo date('Y-m-d H:i:s', $time)." [".$this->names[$runlevel]."]: ".$msg."\n";
-		echo $time." [".$this->names[$runlevel]."]: ".$msg."\n";
+		//echo date('H:i:s',$time)  . " [".$this->names[$runlevel]."]: ".$msg."\n";
+		dpm( date('H:i:s', $time) . " [".$this->names[$runlevel]."]: ".$msg."\n" );
 	}
 }
diff -wBNru xmppframework-orig/contrib/xmpp_api/vendor/XMPPHP/XMPP.php xmppframework-mod/contrib/xmpp_api/vendor/XMPPHP/XMPP.php
--- xmppframework-orig/contrib/xmpp_api/vendor/XMPPHP/XMPP.php	2009-08-27 17:46:42.000000000 -0400
+++ xmppframework-mod/contrib/xmpp_api/vendor/XMPPHP/XMPP.php	2010-03-30 00:47:14.000000000 -0400
@@ -99,6 +99,9 @@
 	public function __construct($host, $port, $user, $password, $resource, $server = null, $printlog = false, $loglevel = null) {
 		parent::__construct($host, $port, $printlog, $loglevel);
 
+        // use this for debugging
+		//parent::__construct($host, $port, true, 4);
+
 		$this->user	 = $user;
 		$this->password = $password;
 		$this->resource = $resource;
@@ -208,6 +211,7 @@
 	 * @param string $xml
 	 */
 	public function presence_handler($xml) {
+/*
 		$payload['type'] = (isset($xml->attrs['type'])) ? $xml->attrs['type'] : 'available';
 		$payload['show'] = (isset($xml->sub('show')->data)) ? $xml->sub('show')->data : $payload['type'];
 		$payload['from'] = $xml->attrs['from'];
@@ -225,6 +229,7 @@
 		} else {
 			$this->event('presence', $payload);
 		}
+*/
 	}
 
 	/**
@@ -265,7 +270,8 @@
 		$this->log->log("Auth failed!",  XMPPHP_Log::LEVEL_ERROR);
 		$this->disconnect();
 
-		throw new XMPPHP_Exception('Auth failed!');
+        // TODO:
+		//throw new XMPPHP_Exception('Auth failed!');
 	}
 
 	/**
@@ -331,10 +337,13 @@
         * Retrieves the vcard
         *
         */
-        public function getVCard() {
+        public function getVCard($jid = NULL) {
                 $id = $this->getID();
                 $this->addIdHandler($id, 'vcard_get_handler');
+                if (!isset($jid))
                 $this->send("<iq type='get' id='$id'><vCard xmlns='vcard-temp' /></iq>");
+                else
+                    $this->send("<iq type='get' id='$id' to='$jid'><vCard xmlns='vcard-temp' /></iq>");
         }
 
         /**
@@ -351,6 +360,7 @@
                                 $vcard = array();
                                 $element = $xml->sub('vcard');
                                 // go through all of the sub elements and add them to the vcard array
+                                if (is_array($element->subs)) { // PATCH
                                 foreach ($element->subs as $sub) {
                                         if (preg_match('/button/', $sub->name)) { continue; }
                                         $vcard[$sub->name] = $sub->data;
@@ -360,6 +370,7 @@
                                                 }
                                         }
 		                }
+                                }
                                 $this->event('vcard_received', $vcard);
                                 break;
                         default:
@@ -498,6 +509,228 @@
         }
 
         /**
+        * Generate a random string
+        *
+        * @param $entity
+        *       Entity we want information about
+        */
+        private function genRandomString($length = 10) {
+            // This variable contains the list of allowable characters for the
+            // password. Note that the number 0 and the letter 'O' have been
+            // removed to avoid confusion between the two. The same is true
+            // of 'I', 1, and 'l'.
+            $allowable_characters = 'abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789';
+
+            $len = strlen($allowable_characters) - 1;
+            $pass = '';
+
+            for ($i = 0; $i < $length; $i++) {
+                $pass .= $allowable_characters[mt_rand(0, $len)];
+            }
+
+            return $pass;
+
+        }
+
+        /**
+        * Determine if an username exists on our server.
+        *
+        * @param $username
+        *       The username we are searching for.
+        */
+        public function userExists($username) {
+    
+                $id = 'exec_' . $this->getID();
+                $xml = "<iq type='set' to='{$this->server}' id='$id'>
+                          <command xmlns='http://jabber.org/protocol/commands'
+                                   node='http://jabber.org/protocol/admin#get-user-password'>
+                            <x xmlns='jabber:x:data' type='submit'>
+                              <field var='accountjid'>
+                                <value>$username@{$this->server}</value>
+                              </field> 
+                            </x>
+                          </command>
+                        </iq>";
+
+                $this->addIdHandler($id, 'user_exists_handler');
+                $this->send($xml);
+        }
+
+        /**
+        * Handler for username search results
+        *
+        * @param XML Object $xml
+        */
+        protected function user_exists_handler($xml) {
+                switch ($xml->attrs['type']) {
+                        case 'error':
+                                $this->event('user_exists', 'error');
+                                break;
+                        case 'result':
+                                $this->event('user_exists', 'result');
+                                break;
+                        default:
+                                $this->event('user_exists', 'default');
+                }
+        }
+
+
+        /**
+        * Change password.
+        *
+        * @param $entity
+        *       Entity we want information about
+        */
+        public function changePassword($username, $password) {
+    
+                $id = 'exec_' . $this->getID();
+                $xml = "<iq type='set' to='{$this->server}' id='$id'>
+                          <command xmlns='http://jabber.org/protocol/commands'
+                                   node='http://jabber.org/protocol/admin#change-user-password'>
+                            <x xmlns='jabber:x:data' type='submit'>
+                              <field var='accountjid'>
+                                <value>$username@{$this->server}</value>
+                              </field>
+                              <field var='password'>
+                                <value>$password</value>
+                              </field>
+                            </x>
+                          </command>
+                        </iq>";
+
+                $this->addIdHandler($id, 'change_password_handler');
+                $this->send($xml);
+        }
+
+        /**
+        * Handler for new user registration
+        *
+        * @param XML Object $xml
+        */
+        protected function change_password_handler($xml) {
+                switch ($xml->attrs['type']) {
+                        case 'error':
+                                $this->event('password_changed', 'error');
+                                break;
+                        case 'result':
+                                $this->event('password_changed', 'result');
+                                break;
+                        default:
+                                $this->event('pasword_changed', 'default');
+                }
+        }
+
+
+        /**
+        * Register a new user.
+        *
+        * @param $entity
+        *       Entity we want information about
+        */
+        public function registerNewUser($username, $password = NULL) {
+    
+                if (!isset($password))
+                    $password = $this->genRandomString(15);
+
+                $id = 'reg_' . $this->getID();
+                $xml = "<iq type='set' id='$id'>
+                            <query xmlns='jabber:iq:register'>
+                                <username>" . $username . "</username>
+                                <password>" . $password . "</password>
+                                <email></email>
+                                <name></name>
+                            </query>
+                        </iq>";
+
+                $this->addIdHandler($id, 'register_new_user_handler');
+                $this->send($xml);
+        }
+
+        /**
+        * Handler for new user registration
+        *
+        * @param XML Object $xml
+        */
+        protected function register_new_user_handler($xml) {
+                switch ($xml->attrs['type']) {
+                        case 'error':
+                                $this->event('new_user_registered', 'error');
+                                break;
+                        case 'result':
+                                $query = $xml->sub('query');
+                                foreach ($query->subs as $key => $value) {
+                                    switch ($value->name) {
+                                        case 'username':
+                                            $username = $value->data;
+                                            break;
+
+                                        case 'password':
+                                            $password = $value->data;
+                                            break;
+                                    }
+                                }
+
+                                $this->event('new_user_registered', array('jid' => $username . "@{$this->server}", 'password' => $password));
+                                break;
+                        default:
+                                $this->event('new_user_registered', 'default');
+                }
+        }
+
+        /**
+        * Register a new random user.
+        *
+        * @param $entity
+        *       Entity we want information about
+        */
+        public function registerRandomUser() {
+                $id = 'reg_' . $this->getID();
+                $xml = "<iq type='set' id='$id'>
+                            <query xmlns='jabber:iq:register'>
+                                <username>" . 'chatbot_' . $this->genRandomString(10) . "</username>
+                                <password>" . $this->genRandomString(15) . "</password>
+                                <email></email>
+                                <name></name>
+                            </query>
+                        </iq>";
+
+                $this->addIdHandler($id, 'register_random_user_handler');
+                $this->send($xml);
+        }
+
+
+        /**
+        * Handler for random user registration
+        *
+        * @param XML Object $xml
+        */
+        protected function register_random_user_handler($xml) {
+                switch ($xml->attrs['type']) {
+                        case 'error':
+                                $this->event('random_user_registered', 'error');
+                                break;
+                        case 'result':
+                                $query = $xml->sub('query');
+                                foreach ($query->subs as $key => $value) {
+                                    switch ($value->name) {
+                                        case 'username':
+                                            $username = $value->data;
+                                            break;
+
+                                        case 'password':
+                                            $password = $value->data;
+                                            break;
+                                    }
+                                }
+
+                                $this->event('random_user_registered', array('jid' => $username . "@{$this->server}", 'password' => $password));
+                                break;
+                        default:
+                                $this->event('random_user_registered', 'default');
+                }
+        }
+
+        /**
         * Discover what the xmpp server supports
         *
         * @param $entity
@@ -615,7 +848,7 @@
                 $node = $data['command']['node'];
                 $sessionid = $data['command']['sessionid'];
                 $id = $this->getID();
-                $xml = "<iq id='$id' type='set' to='chat.openband.net'>";
+                $xml = "<iq id='$id' type='set' to='{$this->server}'>"; // PATCH
                 $xml .= "<command xmlns='$xmlns' node='$node' sessionid='$sessionid'>";
                 $xml .= "<x xmlns='jabber:x:data' type='submit'>";
                 foreach ($data as $key => $value) {
@@ -654,15 +887,20 @@
         }
 
         /**
-        * Send initial presence to let them know we want to create a MUC
+        * Send presence to let them know we want to join/create a MUC
         *
         * @param $room
-        *       Room you wish to create includes user nickname
+        *       Room you wish to join/create includes user nickname
         */
-        public function sendInitialRoomPresence($room) {
+        public function joinMucRoom($room) {
                 $id = $this->getID();
-                $this->addIdHandler($id, 'initial_room_presence_handler');
-                $this->send("<presence to='$room' id='$id' />");
+                $this->addIdHandler($id, 'room_presence_handler');
+
+                // In-band registration ( must already be in the room )
+                //$this->send("<presence to='$room' id='$id' />");
+
+                // simply join
+                $this->send("<presence to='$room' id='$id'><x xmlns='http://jabber.org/protocol/muc'/></presence>");
         }
 
         /**
@@ -671,26 +909,26 @@
         * @param $xml
         *       XML Object
         */
-        protected function initial_room_presence_handler($xml) {
+        protected function room_presence_handler($xml) {
                 switch ($xml->attrs['type']) {
                         case 'error':
-                                $this->event('initial_room_enter', 'error');
+                                $this->event('room_enter', 'error');
                                 break;
                         case 'result':
-                                $this->event('initial_room_enter', 'success');
+                                $this->event('room_enter', 'success');
                                 break;
                         default:
-                                $this->event('initial_room_enter', 'default');
+                                $this->event('room_enter', 'default');
                 }
         }
 
         /**
-        * Function requests room creation and will expect a form in return
+        * Function requests room will expect a form in return
         *
         * @param $room
         *       Room without the nickname this time
         */
-        public function createMucRoom($room) {
+        public function configureMucRoom($room) {
                 $id = $this->getId();
                 $xml = "<iq id='$id' to='$room' type='get'>";
                 $xml .= "<query xmlns='http://jabber.org/protocol/muc#owner'/>";
@@ -736,7 +974,7 @@
         * @param $data
         *       Array holding the form submission information
         */
-        public function createMucRoomFormSend($to, $data = array()) {
+        public function configureMucRoomFormSend($to, $data = array()) {
                 $id = $this->getId();
                 $xml = "<iq type='set' id='$id' to='$to'>";
                 $xml .= "<query xmlns='http://jabber.org/protocol/muc#owner'>";
diff -wBNru xmppframework-orig/contrib/xmpp_api/xmpp_api.internal.inc xmppframework-mod/contrib/xmpp_api/xmpp_api.internal.inc
--- xmppframework-orig/contrib/xmpp_api/xmpp_api.internal.inc	2009-07-21 18:16:19.000000000 -0400
+++ xmppframework-mod/contrib/xmpp_api/xmpp_api.internal.inc	2010-03-30 00:53:24.000000000 -0400
@@ -47,7 +47,24 @@
  * @param $xmppaccount
  *   User account, will default to the current user
  */
+function xmpp_api_get_new_connection($jid, $password) {
+
+    if ( $conn = _xmpp_api_get_connection(array('jid' => $jid, 'password' => $password))) {
+        return $conn;
+    } else {
+        return FALSE;
+    }
+}
+
+
+/**
+ * Get connection object with some account credentials
+ *
+ * @param $xmppaccount
+ *   User account, will default to the current user
+ */
 function xmpp_api_get_user_connection($xmppaccount) {
+
   if ($conn = _xmpp_api_get_connection($xmppaccount)) {
     return $conn;
   } else {
@@ -97,6 +114,81 @@
 }
 
 /**
+ * Change the password for an existing account
+ *
+ * @param $jid
+ *      The jid
+ */
+function xmpp_api_change_password($jid, $password, $conn = NULL) { 
+  if ($conn = _xmpp_api_server_connection($conn)) {
+
+      list($username, $domain) = explode('@', $jid);
+      $conn->changePassword($username, $password);
+      $payload = $conn->processUntil('password_changed', XMPP_API_PROCESS_TIMEOUT);
+
+      if ($payload[0][1] != 'result') {
+          watchdog('xmpp_api', 'Could not change password for %jid ', array('%jid' => $jid), WATCHDOG_ERROR);
+          watchdog('xmpp_api', print_r($payload,true));
+          return FALSE;
+      }
+
+      return TRUE;
+  } else {
+      return FALSE;
+  }
+}
+
+/**
+ * Determine if a JID exists.
+ *
+ * @param $jid
+ *      The jid to search for
+ */
+function xmpp_api_jid_exists($jid, $conn = NULL) { 
+  if ($conn = _xmpp_api_server_connection($conn)) {
+
+      list($username, $domain) = explode('@', $jid);
+
+      $conn->userExists($username);
+      $payload = $conn->processUntil('user_exists', XMPP_API_PROCESS_TIMEOUT);
+
+      if ($payload[0][1] != 'result') {
+          return FALSE;
+      }
+
+      return TRUE;
+  } else {
+      return FALSE;
+  }
+}
+
+/**
+ * Create a new jabber account
+ *
+ * @param $jid
+ *      The new jid to create
+ */
+function xmpp_api_create_jid($jid, $password, $conn = NULL) { 
+  if ($conn = _xmpp_api_server_connection($conn)) {
+
+      list($username, $domain) = explode('@', $jid);
+      $conn->registerNewUser($username, $password);
+      $payload = $conn->processUntil('new_user_registered', XMPP_API_PROCESS_TIMEOUT);
+      $credentials = $payload[0][1];
+
+      if (!is_array($credentials)) {
+          watchdog('xmpp_api', 'Could not create jid: %jid ', array('%jid' => $jid), WATCHDOG_ERROR);
+          watchdog('xmpp_api', print_r($payload,true));
+          return FALSE;
+      }
+
+      return $credentials;
+  } else {
+      return FALSE;
+  }
+}
+
+/**
  * Function for setting the users presence in the system
  *
  * @param $account
@@ -128,7 +221,10 @@
  *      User Password
  */
 function xmpp_api_delete_account($name, $host, $password, $conn = NULL) {
-  if (!$conn = _xmpp_api_admin_connection($conn)) {
+
+    if (!($conn = _xmpp_api_server_connection($conn))) {
+    //if (!$conn = _xmpp_api_admin_connection($conn)) {
+        watchdog('xmpp_api', 'Could not get a connection', array(), WATCHDOG_ERROR);
     return FALSE;
   }
 
@@ -177,24 +273,27 @@
     return FALSE;
   }
 
-  // setting the room including nickname we will utilize
-  $room = $name .'@'. $service .'/xwchat-drupal';
 
-  // sending the initial presence to the room so we can create it
-  $conn->sendInitialRoomPresence($room);
-  $payload = $conn->processUntil('initial_room_enter', XMPP_API_PROCESS_TIMEOUT);
-  if ($payload[0][1] != 'result') {
+    $room = $name .'@'. $service . '/ixwchat-drupal';
+
+    // sending request for the form in order to configure the room and receiving processed contents in return
+    $conn->joinMucRoom($room);
+    $payload = $conn->processUntil('room_enter', XMPP_API_PROCESS_TIMEOUT);
+
+    if ($payload[0][1] == 'error') {
     _xmpp_api_disconnect($conn);
-    watchdog('xmpp_api', '@name does not have privileges to create muc rooms', array('@name' => XMPP_API_ADMINJID), WATCHDOG_ERROR);
+        watchdog('xmpp_api', 'Could not join/create the room "@room"', array("@room" => $room), WATCHDOG_ERROR);
     return FALSE;
   }
 
-  // resetting the room variable this time without the nickname on it
   $room = $name .'@'. $service;
+
   // sending request for the form in order to configure the room and receiving processed contents in return
-  $conn->createMucRoom($room);
+    $conn->configureMucRoom($room);
+    $conn->configureMucRoom($room); // Need to do this twice for some reason....
   $payload = $conn->processUntil('muc_created', XMPP_API_PROCESS_TIMEOUT);
   $packet = $payload[0][1];
+
   // if we are not returned an array we know there was an error in the configuration
   if (!is_array($packet)) {
     _xmpp_api_disconnect($conn);
@@ -206,11 +305,12 @@
   $options = _xmpp_api_muc_config_options($title);
   foreach ($packet as $key => $values) {
     if (array_key_exists($key, $options)) {
-      $values['data'] = $options[$key];
+            $packet[$key]['data'] = $options[$key];
     }
   }
+
   // sending request to configure the room with our pertinent information set
-  $conn->createMucRoomFormSend($room, $packet);
+    $conn->configureMucRoomFormSend($room, $packet);
   $payload = $conn->processUntil('muc_configured', XMPP_API_PROCESS_TIMEOUT);
 
   if ($payload[0][1] != 'result') {
@@ -237,7 +338,9 @@
   $room = $name .'@'. $service;
   // sending request for the form in order to configure the room and receiving processed contents in return
   // note at this point it will not create the room since it it should already exist in the system
-  $conn->createMucRoom($room);
+    $conn->configureMucRoom($room);
+    $conn->configureMucRoom($room); // Need to do this twice for some reason....
+
   $payload = $conn->processUntil('muc_created', XMPP_API_PROCESS_TIMEOUT);
   $packet = $payload[0][1];
   // if we are not returned an array we know there was an error in the configuration
@@ -249,11 +352,12 @@
   $options = _xmpp_api_muc_config_options($value);
   foreach ($packet as $key => $values) {
     if (array_key_exists($key, $options)) {
-      $values['data'] = $options[$key];
+            $packet[$key]['data'] = $options[$key];
     }
   }
   // sending request to configure the room with our pertinent information set
-  $conn->createMucRoomFormSend($room, $packet);
+    $conn->configureMucRoomFormSend($room, $packet);
+    $conn->configureMucRoomFormSend($room, $packet); // Need to do this twice for some reason.......
   $conn->processUntil('muc_configured', XMPP_API_PROCESS_TIMEOUT);
 
   if ($payload[0][1] != 'result') {
@@ -485,7 +589,7 @@
   // if we received a username and password use them
   if (!empty($params['jid']) && !empty($params['password'])) {
     $pieces = explode('@', $params['jid']);
-    $params += array('username' => $pieces[0], 'server' =>  $pieces[1]);
+        $params = array_merge($params, array('username' => $pieces[0], 'server' =>  $pieces[1])); // PATCH
   }
 
   // Check minimum parameters and add defaults
@@ -514,7 +618,9 @@
  *
  */
 function _xmpp_api_get_connection($params = array()) {
+
   // Add some defaults
+    
   $params += array(
     'timeout' => 30,
     'persistent' => FALSE,
diff -wBNru xmppframework-orig/contrib/xmpp_api/xmpp_api.module xmppframework-mod/contrib/xmpp_api/xmpp_api.module
--- xmppframework-orig/contrib/xmpp_api/xmpp_api.module	2009-09-25 16:51:04.000000000 -0400
+++ xmppframework-mod/contrib/xmpp_api/xmpp_api.module	2010-03-30 01:05:48.000000000 -0400
@@ -98,6 +99,10 @@
       'get_admin_connection' => 'xmpp_api_get_server_connection',
       'get_user_connection' => 'xmpp_api_get_user_connection',
       'release_connection' => 'xmpp_api_release_connection',
+      'login_as' => 'xmpp_api_get_new_connection',
+      'create_jid' => 'xmpp_api_create_jid',
+      'jid_exists' => 'xmpp_api_jid_exists',
+      'change_password' => 'xmpp_api_change_password',
     );
   }
   return isset($funcs[$op]) ? $funcs[$op] : NULL;
diff -wBNru xmppframework-orig/contrib/xmpp_client/xmpp_client.module xmppframework-mod/contrib/xmpp_client/xmpp_client.module
--- xmppframework-orig/contrib/xmpp_client/xmpp_client.module	2009-09-25 16:51:04.000000000 -0400
+++ xmppframework-mod/contrib/xmpp_client/xmpp_client.module	2010-03-30 01:34:50.000000000 -0400
@@ -380,7 +380,7 @@
   $settings['xmpp_client']['login']['url'] = base_path() . drupal_get_path('module', 'xmpp_client') .'/xwchat/roster.html?';
   $settings['xmpp_client']['login']['username'] = _xmpp_user_parse_jid($user->xmpp_user['jid'], TRUE);
   $settings['xmpp_client']['login']['resource'] = $user->xmpp_user['resource'];
-  $settings['xmpp_client']['login']['domain'] = _xmpp_user_parse_jid($user->xmpp_user['jid'], FALSE);
+  $settings['xmpp_client']['login']['domain'] = variable_get('xmpp_api_server', '127.0.0.1'); // PATCH
   $settings['xmpp_client']['login']['srvUrl'] = url('xmpp_client');
   $settings['xmpp_client']['login']['locale'] = _xmpp_client_determine_locale($user);
   $settings['xmpp_client']['login']['httpbase'] = variable_get('xmpp_client_httpbase', '/http-bind/');
diff -wBNru xmppframework-orig/contrib/xmpp_node_muc/xmpp_node_muc.ajax.inc xmppframework-mod/contrib/xmpp_node_muc/xmpp_node_muc.ajax.inc
--- xmppframework-orig/contrib/xmpp_node_muc/xmpp_node_muc.ajax.inc	2009-04-22 17:46:24.000000000 -0400
+++ xmppframework-mod/contrib/xmpp_node_muc/xmpp_node_muc.ajax.inc	2010-03-30 00:27:43.000000000 -0400
@@ -20,7 +20,7 @@
       if (!(_xmpp_node_muc_count_users_from_gid($group->gid))) {
         db_query("INSERT INTO {xmpp_node_muc_users} (gid, nid, uid, jid, nickname, join_time) VALUES (%d, %d, %d, '%s', '%s', %d)", $group->gid, $group->nid, $user->uid, $user->xmpp_user['jid'], $nickname, time());
       }
-      $output .= 'if (attribute.html() == "'. t('Create Chat Room') .'") { attribute.html("'. t('Join Chat Room') .'"); };';
+      $output .= 'if (attribute.html() == "'. t('Create Chat Room') .'") { attribute.html("'. t('Join Chat Room!') .'"); };';
     }
     else {
       // Inform the user that the xmpp client module is required in order to utilize this functionality
@@ -46,7 +46,7 @@
         $nickname = $user->name;
         // adding the user since we know they are about to be put into the muc xmlrpc will take care if additional one comes
         db_query("INSERT INTO {xmpp_node_muc_users} (gid, nid, uid, jid, nickname, join_time) VALUES (%d, %d, %d, '%s', '%s', %d)", $gid, $group->nid, $user->uid, $user->xmpp_user['jid'], $nickname, time());
-        $output .= 'if (attribute.html() == "'. t('Create Chat Room') .'") { attribute.html("'. t('Join Chat Room') .'"); };';
+        $output .= 'if (attribute.html() == "'. t('Create Chat Room') .'") { attribute.html("'. t('Join Chat Room!') .'"); };';
       }
       else {
         // Inform the user that the xmpp client module is required in order to utilize this functionality
@@ -93,7 +93,7 @@
       // Calling the helper function that will update the log messages
       $output .= 'Drupal.xmpp_node_muc.updateTempLog(\''. $row->gid .'\', \''. str_replace("'", "", implode("", $listitem)) .'\');';
       $output .= '$(document).ready(function() { $(".block-xmpp_node_muc").show(); });';
-      $output .= '$("li.xmpp_node_muc a").html("'. t('Join Chat Room') .'");';
+      $output .= '$("li.xmpp_node_muc a").html("'. t('Join Chat Room!') .'");';
     }
     else {
       $output .= '$(document).ready(function() { $(".block-xmpp_node_muc").hide(); });';
diff -wBNru xmppframework-orig/contrib/xmpp_node_muc/xmpp_node_muc.module xmppframework-mod/contrib/xmpp_node_muc/xmpp_node_muc.module
--- xmppframework-orig/contrib/xmpp_node_muc/xmpp_node_muc.module	2009-09-25 16:51:05.000000000 -0400
+++ xmppframework-mod/contrib/xmpp_node_muc/xmpp_node_muc.module	2010-03-30 01:10:08.000000000 -0400
@@ -497,7 +498,8 @@
       // If this is going to be a permanent node we want too create the group as private
       if (xmpp_node_muc_type($node->type) == XMPP_NODE_MUC_PERMANENT) {
         // making the group muc members only so only group members can enter the muc
-        xmppframework_configure_muc($name, $service, $server, 'members_only', true);
+        //xmppframework_configure_muc($name, $service, $server, 'members_only', true);
+        xmppframework_configure_muc($name, $service, $server, 'members_only', ''); // PATCH
       }
       return $gid;
     }
diff -wBNru xmppframework-orig/contrib/xmpp_node_muc/xmpp_node_muc.page.inc xmppframework-mod/contrib/xmpp_node_muc/xmpp_node_muc.page.inc
--- xmppframework-orig/contrib/xmpp_node_muc/xmpp_node_muc.page.inc	2009-09-25 16:51:05.000000000 -0400
+++ xmppframework-mod/contrib/xmpp_node_muc/xmpp_node_muc.page.inc	2010-03-30 00:27:43.000000000 -0400
@@ -30,7 +30,7 @@
   global $user;
 
   $output .= '<div id="xmpp_node_muc_create_muc">';
-  $output .= l(t('Create Additional MUC'), 'node/'. $node->nid .'/create_muc', array());
+  $output .= l(t('Create Chat Rooms'), 'node/'. $node->nid .'/create_muc', array());
   $output .= '</div>';
   $output .= '<table id="xmpp_node_muc_mucs">';
   $output .= '<tr class="xmpp_node_muc_muc_title">';
@@ -76,7 +76,7 @@
   );
   $form['name'] = array(
     '#type' => 'textfield',
-    '#title' => t('MUC Name'),
+    '#title' => t('Chat Room Name'),
     '#size' => 30,
   );
   $form['submit'] = array(
@@ -108,7 +108,7 @@
     db_query("INSERT INTO {xmpp_node_muc_groups} (gid, nid, title, sub_group, name) VALUES (%d, %d, '%s', %d, '%s')", $gid, $nid, $title, $sub_group, $form_state['values']['name']);
     // create the muc with the pertinent information
     _xmpp_node_muc_create_muc($name, $service, $server, $form_state['values']['name']);
-    drupal_set_message(t('!name muc has been created', array('!name' => $form_state['values']['name'])));
+    drupal_set_message(t('!name chat room has been created', array('!name' => $form_state['values']['name'])));
   }
   else {
     drupal_set_message(t('No server / service is configured for chat room creation. Please contact your site administrator regarding this issue.'), 'error');
@@ -152,7 +152,7 @@
   // get the number of participants in this muc
   $count = db_result(db_query("SELECT COUNT(jid) FROM {xmpp_node_muc_users} WHERE nid = %d AND gid = %d", $node->nid, $gid));
   $output = '<div id="xmpp_node_muc_mucs_edit">';
-  $output .= '<div>'. l(t('Delete MUC'), 'node/'. $node->nid . '/delete_muc/'. $gid, array('onclick' => 'return confirm("Are you sure?")')) .'</div>';
+  $output .= '<div>'. l(t('Delete Chat Room'), 'node/'. $node->nid . '/delete_muc/'. $gid, array('onclick' => 'return confirm("Are you sure?")')) .'</div>';
   $output .= '<div><span class="title">'. t('Conference Name') .': </span> <span class="message">'. $group->name .'</span></div>';
   $output .= '<div><span class="title">'. t('Subject') .': </span> <span class="message">'. ((drupal_strlen($group->subject)) ? $group->subject : t('Not Set')) .'</span></div>';
   $output .= '<div><span class="title">'. t('Participants') .': </span> <span class="message">'. $count .'</span></div>';
diff -wBNru xmppframework-orig/contrib/xmpp_roster/xmpp_roster.internal.inc xmppframework-mod/contrib/xmpp_roster/xmpp_roster.internal.inc
--- xmppframework-orig/contrib/xmpp_roster/xmpp_roster.internal.inc	2009-04-22 16:33:54.000000000 -0400
+++ xmppframework-mod/contrib/xmpp_roster/xmpp_roster.internal.inc	2010-03-30 01:11:30.000000000 -0400
@@ -58,7 +58,7 @@
     if (isset($relationship->xmpp_user['jid'])) {
       $jid = $relationship->xmpp_user['jid'];
       // determine if the jid exists in the users roster
-      if (array_key_exists($jid, $roster)) {
+      if (is_array($roster) && array_key_exists($jid, $roster)) {
         if (!isset($sync[$jid])) {
           $processed['both'][$jid] = array('uid' => $relationship->uid, 'name' => $relationship->name, 'created' => $object->created_at, 'type' => array());
         }
@@ -128,7 +129,7 @@
   }
   $chatid = $cuser->name .'@'. $cuser->xmpp_user['server'];
   // delete item from the xmpp roster
-  $conn = xmppframework_get_user_connect($user);
+  $conn = xmppframework_get_user_connection($user); // PATCH
   if ($conn !== FALSE) {
     $result = xmppframework_delete_rosteritem($user->name, $user->xmpp_user['server'], $cuser->name, $cuser->xmpp_user['server'], $conn);
     if ($result === TRUE) {
diff -wBNru xmppframework-orig/contrib/xmpp_roster/xmpp_roster.theme.inc xmppframework-mod/contrib/xmpp_roster/xmpp_roster.theme.inc
--- xmppframework-orig/contrib/xmpp_roster/xmpp_roster.theme.inc	2009-09-25 16:51:05.000000000 -0400
+++ xmppframework-mod/contrib/xmpp_roster/xmpp_roster.theme.inc	2010-03-30 00:27:43.000000000 -0400
@@ -43,7 +43,7 @@
       $output .= theme('table', $header, $entry);
     }
     else {
-      $output .= '<div style="text-align: center;">'. t('No relationships were found that we in your XMPP and User Relationships') .'</div>';
+      $output .= '<div style="text-align: center;">'. t('No relationships were found that were in your XMPP and Friends list') .'</div>';
     }
   }
 
@@ -51,7 +51,7 @@
     // retrieving all associations that are in user relationships only
     $relationship = $associations['relationship'];
     if (is_array($relationship) && !empty($relationship)) {
-      $output .= t('<h2>Associates with User Relationships only</h2>');
+      $output .= t('<h2>Friends only</h2>');
       foreach ($relationship as $key => $values) {
         $uid = $values['uid'];
         // This is done so we make sure the translations are displayed correctly
@@ -85,7 +85,7 @@
     // retrieving all associations that are in xmpp only
     $xmpp = $associations['xmpp'];
     if (is_array($xmpp) && !empty($xmpp)) {
-      $output .= t('<h2>Associates with XMPP Roster relationships only</h2>');
+      $output .= t('<h2>XMPP only</h2>');
       foreach ($xmpp as $key => $values) {
         if (isset($xmpp[$key]) && isset($xmpp[$key]['uid']) && is_numeric($xmpp[$key]['uid'])) {
           if (db_result(db_query("SELECT COUNT(uid) FROM {users} WHERE uid = %d", $xmpp[$key]['uid']))) {
diff -wBNru xmppframework-orig/contrib/xmpp_user/xmpp_user.module xmppframework-mod/contrib/xmpp_user/xmpp_user.module
--- xmppframework-orig/contrib/xmpp_user/xmpp_user.module	2009-09-25 16:51:05.000000000 -0400
+++ xmppframework-mod/contrib/xmpp_user/xmpp_user.module	2010-03-30 01:28:53.000000000 -0400
@@ -29,7 +29,7 @@
  * Implementation of hook_perm()
  */
 function xmpp_user_perm() {
-  return array('administer xmpp user');
+  return array('administer xmpp user', 'change xmpp password');
 }
 
 /**
@@ -58,9 +58,23 @@
     'access arguments' => array('administer xmpp user'),
     'file' => 'xmpp_user.admin.inc',
   );
+  $items['confirmation/%'] = array(
+    'title' => 'Change your XMPP password',
+    'description' => '',
+    'page callback' => 'xmpp_user_change_password',
+    'page arguments' => array(1),
+    'access arguments' => array('change xmpp password'),
+    'file' => 'xmpp_user.admin.inc',
+  );
   return $items;
 }
 
+function xmpp_user_change_password($hash)
+{
+    return 'Change your password here: ';
+}
+
+
 /**
  * Implementation of hook_service().
  */
@@ -283,6 +304,7 @@
     elseif (isset($edit['xmpp_user']['password']) && !is_null($edit['xmpp_user']['password']) && drupal_strlen($edit['xmpp_user']['password'])) {
       $password = xmpp_user_encrypt_password($edit['xmpp_user']['password']);
       db_query("UPDATE {xmpp_user} SET jid = '%s', resource = '%s', password = '%s' WHERE uid = %d", $edit['xmpp_user']['jid'], $resource, $password, $account->uid);
+      $edit['xmpp_user']['password'] = $password;
     }
     elseif (strcmp($resource, $account->xmpp_user['resource'])) {
       db_query("UPDATE {xmpp_user} SET jid = '%s', resource = '%s' WHERE uid = %d", $edit['xmpp_user']['jid'], $resource, $account->uid);
@@ -306,7 +328,7 @@
 function xmpp_user_validate($edit, $account) {
   if (isset($edit['xmpp_user']['jid']) && !is_null($edit['xmpp_user']['jid']) && drupal_strlen($edit['xmpp_user']['jid'])) {
     if (!(eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $edit['xmpp_user']['jid']))) {
-      form_set_error('jid', 'Invalid JID was entered, should be in the form name@domain i.e. xmpp@xmpp.org');
+      form_set_error('jid', 'Invalid JID was entered, should be in the form username@example.com');
     }
   }
 }
@@ -341,20 +363,13 @@
     global $user;
     $account = $user;
   }
+
   // Verify that the user actually has a password associated with their account for xmpp
-  if (isset($account->xmpp_user['password']) && !is_null($account->xmpp_user['password']) && drupal_strlen($account->xmpp_user['password'])) {
-    $password = $account->xmpp_user['password'];
-    if ($decrypt === TRUE) {
-      $password = xmpp_user_decrypt_password($password);
-    }
-  }
-  else {
     // If nothing re-verify the database table just incase it was missing
     $password = db_result(db_query("SELECT password FROM {xmpp_user} WHERE uid = %d", $account->uid));
     if (!is_null($password) && drupal_strlen($password)) {
       $password = xmpp_user_decrypt_password($password);
     }
-  }
   return $password;
 }
 
@@ -404,15 +419,36 @@
  *      Update the jid even if it was previously set
  */
 function _xmpp_user_provision_jid($user, $update = FALSE) {
+
   // casting to object incase we are given an array
   $user = (object)$user;
+
   // doing the pertinent provisioning for the module
   if (variable_get('xmpp_user_provisioning_on', false) && drupal_strlen(variable_get('xmpp_user_provisioning_server', ''))) {
-    $tjid = db_result(db_query("SELECT jid FROM {xmpp_user} WHERE uid = %d", $user->uid));
-    // checking if the jid is currently set or not, do not wish to overwrite what is there
-    if ((is_null($tjid) || drupal_strlen($tjid)) || $update === TRUE) {
+    $tjid = NULL;
+    $r = db_query("SELECT jid, password FROM {xmpp_user} WHERE uid = %d", $user->uid);
+    if ($r && ($row = db_fetch_array($r)))
+    {
+        $tjid = $row['jid'];
+    }
       $jid = $user->name .'@'. variable_get('xmpp_user_provisioning_server', '');
+    
+    $conn = xmppframework_get_admin_connection();
+    if ($conn === FALSE) {
+        drupal_set_message('Could not connect to chat server to update your information.', 'error');
+        return;
+    }
+
+    // Must use $conn. Will not work if $conn is not used
+    if (xmppframework_jid_exists($jid, $conn)) {
+        if (xmppframework_change_password($user, $jid, xmpp_user_get_password($user), $conn) !== FALSE) {
       db_query("UPDATE {xmpp_user} SET jid = '%s' WHERE uid = %d", $jid, $user->uid);
     }
   }
+    else if (xmppframework_create_jid($jid, xmpp_user_get_password($user), $conn) !== FALSE) {
+        db_query("UPDATE {xmpp_user} SET jid = '%s' WHERE uid = %d", $jid, $user->uid);
+    }
+
+    xmppframework_release_connection($conn);
+  }
 }
diff -wBNru xmppframework-orig/contrib/xmpp_vcard/xmpp_vcard.internal.inc xmppframework-mod/contrib/xmpp_vcard/xmpp_vcard.internal.inc
--- xmppframework-orig/contrib/xmpp_vcard/xmpp_vcard.internal.inc	2009-04-22 12:36:59.000000000 -0400
+++ xmppframework-mod/contrib/xmpp_vcard/xmpp_vcard.internal.inc	2010-03-30 00:27:43.000000000 -0400
@@ -157,7 +158,7 @@
 
   // go through each of the nodes defined as content profiles
   foreach (content_profile_get_types('names') as $type => $type_name) {
-    if ($type == variable_get('xmpp_vcard_profile_type', '')) {
+    if ($type == variable_get('xmpp_vcard_profile_type', 'uprofile')) {
       $profile = content_profile_load($type, $user->uid);
       break;
     }
diff -wBNru xmppframework-orig/xmppframework.module xmppframework-mod/xmppframework.module
--- xmppframework-orig/xmppframework.module	2009-09-25 16:51:04.000000000 -0400
+++ xmppframework-mod/xmppframework.module	2010-03-30 01:22:09.000000000 -0400
@@ -7,7 +7,7 @@
  */
 
 define('XMPPFRAMEWORK_PATH', drupal_get_path('module', 'xmppframework'));
-define('XMPPFRAMEWORK_API',  variable_get('xmppframework_api', ''));
+define('XMPPFRAMEWORK_API',  variable_get('xmppframework_api', 'xmpp_api')); // PATCH
 
 /**
  * Implementation of hook_help().
@@ -126,6 +126,69 @@
   }
 }
 
+function xmppframework_change_password($account, $jid, $password, $connection = NULL)
+{
+    list($username, $domain)  = explode('@', $jid);
+
+    $u = user_load($username);
+
+    if (isset($u->uid) && $u->uid > 0 && $account->uid != $u->uid)
+    {
+        watchdog('xmppframework', 'Failed attempt by %user to change password for a jid that is reserved for an existing Kudos account: %jid', 
+                array('%user' => $account->name, '%jid' => $jid), WATCHDOG_ERROR);
+
+        return FALSE;
+    }
+
+    if (_xmppframework_api_invoke('change_password', $username . '@' . 'kudoscoins.com', $password, $connection)) {
+        return TRUE;
+    } else {
+        return FALSE;
+    }
+}
+
+function xmppframework_jid_exists($jid, $connection = NULL)
+{
+    if (_xmppframework_api_invoke('jid_exists', $jid, $connection)) {
+        return TRUE;
+    } else {
+        return FALSE;
+    }
+}
+
+function xmppframework_create_jid($jid, $password = NULL, $connection = NULL) {
+    if ($credentials = _xmppframework_api_invoke('create_jid', $jid, $password, $connection)) {
+        return $credentials;
+    } else {
+        watchdog('xmppframework', 'Failed to create jid %jid', array('%jid' => $jid), WATCHDOG_ERROR);
+        return FALSE;
+    }
+}
+
+function xmppframework_send_message_as($from, $to, $type = 'chat', $body = null, $subject = null, $connection = NULL) {
+    if (!is_array($from))
+    {
+        watchdog('xmppframework', 'Parameter "from" needs to be an array.', array(), WATCHDOG_ERROR);
+        return FALSE;
+    }
+    if ($connection == NULL)
+    {
+        $connection = _xmppframework_api_invoke('login_as', $from['jid'], $from['password']);
+        if ($connection == NULL)
+        {
+            watchdog('xmppframework', 'Failed to login as user %jid', array('%jid' => $from['jid']), WATCHDOG_ERROR);
+            return FALSE;
+        }
+    }
+
+    if (_xmppframework_api_invoke('send_message', $to, $type, $body, $subject, $connection)) {
+        return TRUE;
+    } else {
+        watchdog('xmppframework', 'Failed to send message to user %to', array('%to' => $to), WATCHDOG_ERROR);
+        return FALSE;
+    }
+}
+
 /**
  *
  * @param $user
@@ -333,7 +397,7 @@
  * $vcard['bday'] = '02/12/2001';
  *
  */
-function xmppframework_set_user_vcard($user = NULL, $vcard = array(), $connection = NULL) {
+function xmppframework_set_user_vcard($vcard = array(), $user = NULL, $connection = NULL) {
   if (_xmppframework_api_invoke('set_vcard', $user, $vcard, $connection)) {
     return TRUE;
   } else {
@@ -441,7 +505,7 @@
     $xmppaccount = $account->xmpp_user;
     // Some parameters need aditional mappings
     $xmppaccount['username'] = $account->xmpp_user['user_name'];
-    $xmppaccount['password'] = xmpp_user_get_password($account);
+    $xmppaccount['password'] = xmpp_user_get_password($account, true); // PATCH
     $xmppaccount['account'] = $account; // Add the full account here for further reference
     return $xmppaccount;
   } else {
