Fiji Web Design
Welcome, Guest
Please Login or Register.    Lost Password?
Joomla AjaxChat Feature Requests (1 viewing) (1) Guest
Go to bottom Post Reply Favoured: 0
TOPIC: Joomla AjaxChat Feature Requests
#126
admin (Admin)
Admin
Posts: 230
graph
User Online Now Click here to see the profile of this user
Joomla AjaxChat Feature Requests 4 Months, 3 Weeks ago Karma: 5  
Please post your feature requests are replies to this thread.

Accepted Feature Requests will be added to the list below and added to a next version or AjaxChat or major release:


Accepted Feature Requests:

1) Sound - sound functionality for messages and notifications (AjaxChat 1.5)
2) Live users to show chatters and/or icon indicating user is chatting
3) File Transfer between private chatters
4) Blinking of PM when new message arrives
5) Usernames and Name switching
6) Language Files
7) Turn AjaxChat Offline with Offline Message
 
Report to moderator   Logged Logged  
 
Last Edit: 2008/11/21 15:38 By admin.
  The administrator has disabled public write access.
#153
admin (Admin)
Admin
Posts: 230
graph
User Online Now Click here to see the profile of this user
Re:Joomla AjaxChat Feature Requests 4 Months ago Karma: 5  
File Transfer to be added to AjaxChat 1.5.
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#188
sjaakiek (User)
Fresh Boarder
Posts: 4
graphgraph
User Offline Click here to see the profile of this user
Re:Joomla AjaxChat Feature Requests 3 Months, 2 Weeks ago Karma: 0  
Requested feature:
- possibility to server side switch between using the joomla username and the joomla realname to represent chatters ( if you want I can give you some code changes I made to implement realnames instead of usernames)
 
Report to moderator   Logged Logged  
 
Last Edit: 2008/09/18 08:36 By sjaakiek.
  The administrator has disabled public write access.
#189
admin (Admin)
Admin
Posts: 230
graph
User Online Now Click here to see the profile of this user
Re:Joomla AjaxChat Feature Requests 3 Months, 2 Weeks ago Karma: 5  
The code changes would be most welcome. Please post them if you can.

At the moment, only the liveusers module has this feature. The chat doesn't.
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#191
sjaakiek (User)
Fresh Boarder
Posts: 4
graphgraph
User Offline Click here to see the profile of this user
Re:Joomla AjaxChat Feature Requests 3 Months, 2 Weeks ago Karma: 0  
ok here goes nothing , note that these changes are made in Ajaxchat for J 1.5 version 0.1c.

Also note that I have not made any effort yet to add a switch in the backend, that still have to be made, I also don't allow public access to the chat only registered, I don't know if that crashes something, but I don't think so.

ajaxchat.class.php
- replace the newmessages function
function newMessages($roomid, $recipient, &$sess, $exclude = false) {
      global $_COOKIE, $my, $ajaxChat_config;
      
        // make sure there is a session
        if (!$sess->session == $_COOKIE['ajax_chat_user']) {
            $this->error( 201, 'Session is invalid.');
            return false;
        }

        // select the new messages in the specified room for the user
		if (!$exclude) {
           $query = "SELECT ac.id AS id, ac.username AS username, u.name AS name, msg, time, DATE_FORMAT(time, '%h%:%i:%s%p')AS f_time , recipient ".
           "FROM #__ajax_chat AS ac, #__users AS u WHERE userid = u.id AND ac.id > '".$sess->last_request_id."' AND room_id = '".$roomid."'".
           " AND (".
           "(recipient = '".$recipient."' AND room_id != '-1') ". // non private messages
           "OR (recipient = '".$my->username."' AND ac.username = '".$recipient."') ". // pms sent to user by recipient
           "OR (recipient = '".$recipient."' AND ac.username = '".$my->username."')". // pms sent to recipient by user
           ")".
		   ($ajaxChat_config['_presence'] ? "" : " AND type != 'system'").
           " ORDER BY id ASC";
		  } else {
		  	$query = "SELECT ac.id AS id, ac.username AS username, u.name AS name, msg, time, DATE_FORMAT(time, '%h%:%i:%s%p')AS f_time , recipient ".
           "FROM #__ajax_chat AS ac, #__users AS u WHERE userid = u.id AND ac.id > '".$sess->last_request_id."' AND room_id = '".$roomid."'".
           " AND (".
           "(recipient = '".$recipient."' AND room_id != '-1' AND ac.username != '".$exclude."') ". // non private messages not by me
           "OR (recipient = '".$my->username."' AND ac.username = '".$recipient."') ". // pms sent to me
           ")".
		   ($ajaxChat_config['_presence'] ? "" : " AND type != 'system'").
           " ORDER BY id ASC";
		  }
           $this->_db->setQuery( $query );
           $msgs = $this->_db->loadObjectList();

           // select the last chat msg id, user can only view msgs after this
           $msgs_count = count($msgs);

        if ($msgs_count  > 0) {

            $lr_id = $msgs[$msgs_count - 1]->id;
            echo '<!-- new messages last id: '.$lr_id.' //-->';
            // update the last request id and time
            $query = "UPDATE #__ajax_chat_sessions SET ".
            "last_request_time = CURRENT_TIMESTAMP(), last_request_id = '".$lr_id."'".
            " WHERE session = '".$sess->session."' AND room_id = '".$roomid."'".
            " AND recipient = '".$recipient."' LIMIT 1";
            $this->_db->setQuery( $query );
            $this->_db->query();
            return $msgs;

        } else {

            // update the last request time
            $query = "UPDATE #__ajax_chat_sessions SET ".
            "last_request_time = CURRENT_TIMESTAMP() ".
            " WHERE session = '".$sess->session."' AND room_id = '".$roomid."'".
            " AND recipient = '".$recipient."' LIMIT 1";
            $this->_db->setQuery( $query );
            $this->_db->query();
            $this->error('0', 'No new Messages; roomid: '.$roomid.' recipient: '.$recipient.' username: '.$my->username.' ; last request time updated.');

        }

    }
ajaxchat.xml.php - replace the show_newmsgs_xml funtion
function show_newmsgs_xml( $msgs ) {
		global $database, $Itemid;

            //HTML_ajaxchat::debug(count($msgs), 'count of messages');

            if (count($msgs) > 0) {
                echo '<msgs count="'.count($msgs).'">';
                foreach( $msgs as $msg) {
                    if (showrealnames) { //switch between realnames or usernames
                      echo '<msg user="'. $msg->name .'" userid="'.$msg->userid.'"'.
                      ' ftime="'.$msg->f_time.'" recipient="'.$msg->recipient.'">';}
                    else {
                      echo '<msg user="'. $msg->username .'" userid="'.$msg->userid.'"'.
                      ' ftime="'.$msg->f_time.'" recipient="'.$msg->recipient.'">';}

                    echo XML_ajaxchat::cAttr($msg->msg);
                    echo '</msg>'."\n";
                }
                echo '</msgs>';
            } else {
              echo '<msgs count="0" />';
            }

      }
You should now be able to see real names in all chat windows. Now we might want to change the names in the online users screen. Change the following code. ajaxchat.php - replace showchatters function
function showChatters($roomid) { // show chatters.
  global $database, $my;
  
    HTML_ajaxchat::send_xmlHeaders(); // sends text/xml header
    
    $auth = new ajc_authentication; // authentication class instance
    
   if (!$session = $auth->authenticateSession($roomid)) { // valid session required
        HTML_ajaxchat::show_response_xml('-2', 'Session invalid. (roomid: '.$roomid.')');
        return;
    }
    
    if ($roomid == '-1') { // stop views to pms
    HTML_ajaxchat::show_response_xml('-2', 'You cannot view PM room');
    return;
    }

    // get the list of users in the room  todo: online time offset to cfg
    $query = "SELECT * FROM #__ajax_chat_sessions, #__users AS u WHERE u.id = userid AND room_id = '".$roomid."' "."
    AND last_request_time+1000 > CURRENT_TIMESTAMP() LIMIT 100"; // todo: get in parts
	$database->setQuery( $query );
	$users_row = $database->loadObjectList();
  
  HTML_ajaxchat::showChatters($users_row, $roomid);
  
} // show chatters
ajaxchat.xml.php -replace showchatters function
function showChatters($sessions, $roomid) { // display all users (sessions) in a room

        if (count($sessions) > 0) {
            echo '<users count="'.count($sessions).'">';
            foreach($sessions as $session) { // iterate through users
            if (showrealnames) {
              echo '<user id="'.$session->userid.'" name="'.$session->username.'" displayname="'.$session->name.'" status="'.$session->status.'" />';
            } else {
              echo '<user id="'.$session->userid.'" name="'.$session->username.'" displayname="'.$session->username.'" status="'.$session->status.'" />';
            }
        echo '</users>';
        } else {
            echo '<users count="'.count($sessions).'" />';
        }
    } // users func
ajaxchat.functions.js -replace function getuserlink -replace function displayusers
function displayUsers(myAJAX) {

    try {
    	if (loggingOut == true) return; // drop on logout
        var users_div = document.getElementById('users');

        if (myAJAX.readyState == 4) {
			if (myAJAX.status == 200) {
				
				if (!users_div) {
					// no users div, stop getting users online data
					clearTimeout(usersTimer);
					usersTimer = null; alert('no users');
					return false;
					
				}
				
				var xml = myAJAX.responseXML;
				var text = myAJAX.responseText;
				logger('Response text/xml: ' + text);
	
				// parse the xml
				if (xml) {
				  if (xml.documentElement) {
					var users = xml.documentElement.getElementsByTagName("user");
					//logger(messages);
	
					if (users.length > 0) {
	
						var div = '';
						users_div.innerHTML = '';
						for (var i = 0; i < users.length; i++) {
	
							var userid = users[i].getAttributeNode("id").nodeValue;
							var username = users[i].getAttributeNode("name").nodeValue;
							var name = users[i].getAttributeNode("displayname").nodeValue;
							var userStatus = users[i].getAttributeNode("status").nodeValue;
							var userLink = getUserLink(username, name);
							
							 if (users_table_row_classname_suffix) // highlight my->username
								var sectid = (username == myusername) ? "2" : "1";
								else  var sectid = '';
							
							if (ajc_users_style != 'default') {
								addmsgRow("<b>" + userLink + "</b>", userStatus, users_table_row_classname_suffix+sectid, 'users', ajc_users_style);
							} else {
								var bgcolor = '';
		
								div += "<tr class=\"" + users_table_row_classname + sectid + "\">";
								div += "<td valign=\"top\" bgcolor=\"" + bgcolor + "\">" +
								"<b>" + userLink + "</b></td>";
								div += "<td width=\"60%\" valign=\"top\" bgcolor=\"" + bgcolor + "\"><i>"
								+ userStatus + "</i></td>";
								div += "</tr>";
							}
						}
						
						if (ajc_users_style == 'default') {
							users_div.innerHTML = '<table class="'+users_table_classname+'"><tbody>'+div+'</tbody></table>';
						}
	
					} else {
					  logger('no users logged in.');
					  // make sure we have a connection
					  validateResponse(xml);
					}
				  }
				}
			} else {
				logger("There was a problem retrieving the XML data:\n" + myAJAX.statusText);
			}
			requestMode_users = false;
			if (_setTimeout_users) {
				usersTimer = setTimeout('showUsers(' + roomid + ')', period_users); 
			} else {  _setTimeout_users = true; }
    	}
	} catch(e) { return false; }
} // display users

// write the users link
function getUserLink(username,name) {
    if (username == myusername) return name;  // no link for self
    var linkHtml = '<a href="javascript:;" onclick="privateChat(\''+username+'\');return false;">'+name+'</a>';
    return linkHtml;    
}
I hope I've posted everything, if it is not working let me know and I will send you a zip of the code. regards
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#276
mtk (User)
Fresh Boarder
Posts: 4
graphgraph
User Offline Click here to see the profile of this user
Re:Joomla AjaxChat Feature Requests 2 Months, 2 Weeks ago Karma: 0  
Hello,
this is not really a feature but it is definitely a request:
it would be very helpful (and actually better coding) if all (!!!) language strings will be taken out of the code into a language file (i.e english.php).

this will allow an easier way for language specific sites, to translate the chat into their own language, & of course a multilingual site (i.e with JoomFish), without the need of duplication of files (and/or the component).
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
Go to top Post Reply
Powered by FireBoardget the latest posts directly to your desktop