Changeset 164
- Timestamp:
- 02/01/08 10:48:43 (16 years ago)
- Location:
- trunk/instant_messenger
- Files:
-
- 27 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/instant_messenger/inc/Jabber.abstract.php
r151 r164 32 32 const NOTICE = 'NOTICE'; 33 33 34 private final function _connect( $pUser = false, $pPassword = false )34 private final function _connect( $pUser = false, $pPassword = false, $pConnectionType = false ) 35 35 { 36 36 try … … 53 53 54 54 $return = fread($socket, 4096); 55 #echo __FUNCTION__ . "<br>\n";56 #var_dump($return); 57 #exit;55 fwrite($socket, $pConnectionType); 56 57 $return = fread($socket, 4096); 58 58 59 59 if ( $return == "new" ) … … 72 72 $this->_resource = $RESOURCE; 73 73 74 #var_dump($return);75 #exit;76 74 return $return; 77 75 } … … 83 81 } 84 82 85 protected function connect( $pUser = false, $pPassword = false)86 { 87 try 88 { 89 $_connect = $this->_connect($pUser, $pPassword );90 83 protected function connect($pUser = false, $pPassword = false, $pConnectionType = false) 84 { 85 try 86 { 87 $_connect = $this->_connect($pUser, $pPassword, $pConnectionType); 88 91 89 if ( !$_connect ) 92 90 throw new Exception('[connect] #0. File: ' . __FILE__ . ' :: ' . __LINE__); … … 275 273 $xml .= ($pStatus || $pShow || $pPriority) ? "</presence>" : ''; 276 274 } 277 275 278 276 if ( $this->write($xml) === false ) 279 277 throw new Exception('[presence] #1 it isn\'t possible send presence for ' . $this->_server . '. File: ' . __FILE__ . ' :: ' . __LINE__); -
trunk/instant_messenger/inc/Jabberd2.abstract.php
r151 r164 7 7 class Jabberd2 extends Jabber 8 8 { 9 final function connect($pUser = false, $pPassword = false )9 final function connect($pUser = false, $pPassword = false, $pConnectionType = false) 10 10 { 11 11 try 12 12 { 13 if ( $_connect = parent::connect($pUser, $pPassword) ) 14 return $_connect; 13 if ( $pUser && $pPassword && $pConnectionType ) 14 if ( $_connect = parent::connect($pUser, $pPassword, $pConnectionType) ) 15 return $_connect; 15 16 16 17 return false; … … 68 69 else 69 70 { 70 if($this->writeSocket($this->iq('set', $addid, NULL, NULL, "jabber:iq:roster", $newcontact))) 71 { 71 if ( $this->writeSocket($this->iq('set', $addid, NULL, NULL, "jabber:iq:roster", $newcontact)) ) 72 72 $this->getContacts(); 73 if($this->subscription($pContact['jid'],"subscribe"))74 echo "OK";75 }76 73 } 77 74 } … … 84 81 final function getVcard($pJid) 85 82 { 86 if (is_array($pJid))83 if ( is_array($pJid) ) 87 84 { 88 $jid = ( trim($pJid['jid']) == "this") ? $this->_user . '@' . $this->_server : $pJid['jid'];85 $jid = ( trim($pJid['jid']) == "this" ) ? $this->_user . '@' . $this->_server : $pJid['jid']; 89 86 90 87 if ( !$this->connected ) 91 88 echo "disconnected"; 92 89 else 93 {94 90 $this->writeSocket($this->iq('get', 'vCard', $jid, NULL, "vcard-temp", "<vCard xmlns='vcard-temp'/>")); 95 echo "OK";96 }97 91 } 98 92 else … … 109 103 echo "disconnected"; 110 104 else 111 {112 105 $this->writeSocket($this->iq('set', $id, NULL, NULL, "vcard-temp", "<vCard xmlns='vcard-temp'>".$NewVcard['vcard']."</vCard>")); 113 echo "OK";114 }115 106 } 116 107 117 108 final function removeContact($pContact) 118 109 { 119 110 $delid = 'deluser_' . time(); 120 if ( !$this->connected )111 if ( !$this->connected ) 121 112 echo "disconnected"; 122 113 else 123 114 { 124 if($this->writeSocket($this->iq('set',$delid,NULL,NULL,"jabber:iq:roster","<item jid='".$pContact['jid']."' subscription='remove'/>"))) 125 { 126 $this->getContacts(); 127 if($this->subscription($pContact['jid'],"unsubscribed")) 128 echo "OK"; 129 } 115 if ( $this->writeSocket($this->iq('set',$delid,NULL,NULL,"jabber:iq:roster","<item jid='".$pContact['jid']."' subscription='remove'/>")) ) 116 if ( $this->subscription($pContact['jid'],"unsubscribed") ) 117 echo "OK"; 130 118 } 131 119 } … … 141 129 { 142 130 $this->writeSocket("<presence xmlns='jabber:client' from='".$this->_user."@".$this->_server."' type='".$type."' to='".$jid."'/>"); 143 return true; 131 return true; 144 132 } 145 133 } … … 147 135 final function setPresence($pPresence = false) 148 136 { 149 150 137 if ( !$pPresence ) 151 138 $this->presence(); … … 158 145 159 146 $this->presence($type, $to, $show, $status, $priority); 160 161 147 } 162 148 -
trunk/instant_messenger/inc/class.Ujabber.inc.php
r151 r164 8 8 { 9 9 session_start(); 10 11 $ _user = $_SESSION['phpgw_info']['instant_messenger']['user'];12 $ _pass = $_SESSION['phpgw_info']['instant_messenger']['passwd'];13 $ _server = $_SESSION['phpgw_info']['instant_messenger']['name_jabber'];14 $ _port = $_SESSION['phpgw_info']['instant_messenger']['port_jabber'];15 $ _resource = $_SESSION['phpgw_info']['instant_messenger']['resource_jabber'];16 10 11 $this->_user = $_SESSION['phpgw_info']['instant_messenger']['user']; 12 $this->_pass = $_SESSION['phpgw_info']['instant_messenger']['passwd']; 13 $this->_server = $_SESSION['phpgw_info']['instant_messenger']['name_jabber']; 14 $this->_port = $_SESSION['phpgw_info']['instant_messenger']['port_jabber']; 15 $this->_resource = $_SESSION['phpgw_info']['instant_messenger']['resource_jabber']; 16 17 17 session_write_close(); 18 18 19 if ( $this->connect($ _user . '@' . $_server . '/' . $_resource . ':' . $_port, $_pass) )19 if ( $this->connect($this->_user . '@' . $this->_server . '/' . $this->_resource . ':' . $this->_port, $this->_pass, 'read/write') ) 20 20 $this->connected = true; 21 21 else 22 22 $this->connected = false; 23 24 25 23 } 26 24 … … 29 27 $this->closeSocket(); 30 28 } 31 29 32 30 public final function listen() 33 31 { … … 49 47 $init = time(); 50 48 51 while ( !connection_aborted() && time() - $init < 10 )49 while ( !connection_aborted() && time() - $init < 30 ) 52 50 { 53 51 # read from server and write in the client 54 52 $xml = $this->readSocket(); 55 53 $xml = ( strlen($xml) ) ? $xml : ' '; 56 printf("%s", $xml ); 57 54 printf("%s", $xml); 58 55 ob_flush(); 59 56 flush(); 60 57 usleep(6000); 61 58 } 62 63 59 ob_end_flush(); 64 60 } -
trunk/instant_messenger/inc/class.db_im.inc.php
r151 r164 19 19 function db_im() 20 20 { 21 21 22 session_start(); 22 23 $this->db_name = $_SESSION['phpgw_info']['instant_messenger']['server']['db_name']; … … 27 28 $this->db_type = $_SESSION['phpgw_info']['instant_messenger']['server']['db_type']; 28 29 $this->user_id = $_SESSION['phpgw_info']['instant_messenger']['user_id']; 29 30 session_write_close(); 31 30 32 $this->db = new db(); 31 $this->db->connect($this->db_name,$this->db_host,$this->db_port,$this->db_user,$this->db_pass,$this->db_type); 32 session_write_close(); 33 $this->db->connect($this->db_name,$this->db_host,$this->db_port,$this->db_user,$this->db_pass,$this->db_type); 33 34 } 34 35 -
trunk/instant_messenger/inc/im_acl.inc.php
r151 r164 1 1 <?php 2 for ( $i = 0; $i < sizeof($GLOBALS['phpgw_info']['user']['acl']); $i++ ) 3 { 4 if ( $GLOBALS['phpgw_info']['user']['acl'][$i]['appname'] == 'instant_messenger') 5 { 6 session_start(); 7 $webserver_url = $GLOBALS['phpgw_info']['server']['webserver_url']; 8 $webserver_url = ( !empty($webserver_url) ) ? $webserver_url : '/'; 9 if ( strrpos($webserver_url, '/') === false || strrpos($webserver_url, '/') != (strlen($webserver_url)-1) ) 10 $webserver_url .= '/'; 2 $size_of_ACL = sizeof($GLOBALS['phpgw_info']['user']['acl']); 11 3 12 $webserver_url = $webserver_url . 'instant_messenger/';4 for ( $i = 0; $i < $size_of_ACL && $GLOBALS['phpgw_info']['user']['acl'][$i]['appname'] == 'instant_messenger'; $i++ ); 13 5 14 require_once PHPGW_SERVER_ROOT . '/instant_messenger/inc/im_sessions.inc.php'; 15 require_once PHPGW_SERVER_ROOT . '/instant_messenger/inc/load_lang.php'; 16 17 $DOCUMENT_ROOT = PHPGW_SERVER_ROOT .'/instant_messenger/'; 18 19 $js = array( 20 'js/connector.js', 21 'js/xtools.js', 22 'js/jabber.js', 23 'js/client.js', 24 'js/images.js', 25 'js/dragdrop.js', 26 'js/build_win.js', 27 'js/templates.js', 28 'js/fcommon.js', 29 'js/menu_action.js', 30 'js/functions.js', 31 'js/images.js', 32 'js/cookies_im.js', 33 'js/load.js', 34 ); 6 $webserver_url = $GLOBALS['phpgw_info']['server']['webserver_url']; 7 $webserver_url = ( !empty($webserver_url) ) ? $webserver_url : '/'; 35 8 36 print '<script type="text/javascript">var path_im = "'.$webserver_url.'";</script>'; 37 foreach ( $js as $key => $val ) 38 print '<script src="' . $webserver_url . $val . '?' . filemtime($DOCUMENT_ROOT . $val) . '"></script>'; 39 40 print '<link rel="stylesheet" type="text/css" href="' . $webserver_url . 'templates/default/css/window.css">'; 41 print '<link rel="stylesheet" type="text/css" href="' . $webserver_url . 'templates/default/css/chat.css">'; 42 print '<link rel="stylesheet" type="text/css" href="' . $webserver_url . 'templates/default/css/common.css">'; 43 print '<script type="text/javascript">setTimeout("client()",1000);</script>'; 9 if ( strrpos($webserver_url, '/') === false || strrpos($webserver_url, '/') != (strlen($webserver_url)-1) ) 10 $webserver_url .= '/'; 44 11 45 session_write_close(); 46 } 47 } 12 $webserver_url = $webserver_url . 'instant_messenger/'; 13 14 session_start(); 15 require_once PHPGW_SERVER_ROOT . '/instant_messenger/inc/im_sessions.inc.php'; 16 require_once PHPGW_SERVER_ROOT . '/instant_messenger/inc/load_lang.php'; 17 $_user = $_SESSION['phpgw_info']['instant_messenger']['user']; 18 $_pass = $_SESSION['phpgw_info']['instant_messenger']['passwd']; 19 $_server = $_SESSION['phpgw_info']['instant_messenger']['name_jabber']; 20 $_port = $_SESSION['phpgw_info']['instant_messenger']['port_jabber']; 21 $_resource = $_SESSION['phpgw_info']['instant_messenger']['resource_jabber']; 22 session_write_close(); 23 24 require_once PHPGW_SERVER_ROOT . '/instant_messenger/inc/class.Ujabber.inc.php'; 25 26 $DOCUMENT_ROOT = PHPGW_SERVER_ROOT .'/instant_messenger/'; 27 28 $js = array( 29 'js/connector.js', 30 'js/xtools.js', 31 'js/jabber.js', 32 'js/client.js', 33 'js/images.js', 34 'js/dragdrop.js', 35 'js/build_win.js', 36 'js/templates.js', 37 'js/fcommon.js', 38 'js/menu_action.js', 39 'js/functions.js', 40 'js/images.js', 41 'js/cookies_im.js', 42 'js/load.js', 43 ); 44 45 print '<script type="text/javascript">var path_im = "'.$webserver_url.'";</script>'; 46 47 foreach ( $js as $key => $val ) 48 print '<script src="' . $webserver_url . $val . '?' . filemtime($DOCUMENT_ROOT . $val) . '"></script>'; 49 50 print '<link rel="stylesheet" type="text/css" href="' . $webserver_url . 'templates/default/css/window.css">'; 51 print '<link rel="stylesheet" type="text/css" href="' . $webserver_url . 'templates/default/css/chat.css">'; 52 print '<link rel="stylesheet" type="text/css" href="' . $webserver_url . 'templates/default/css/common.css">'; 53 54 $jabber = new Ujabber; 55 $jabber->connect($_user . '@' . $_server . '/' . $_resource . ':' . $_port, $_pass, 'read/write'); 56 print '<script type="text/javascript">setTimeout("client()",2000);</script>'; 48 57 ?> -
trunk/instant_messenger/inc/im_sessions.inc.php
r151 r164 2 2 3 3 $_SESSION['phpgw_info']['instant_messenger']['user'] = $GLOBALS['phpgw_info']['user']['account_lid']; 4 $_SESSION['phpgw_info']['instant_messenger']['user_id'] 4 $_SESSION['phpgw_info']['instant_messenger']['user_id'] = $GLOBALS['phpgw_info']['user']['account_id']; 5 5 $_SESSION['phpgw_info']['instant_messenger']['passwd'] = $GLOBALS['phpgw_info']['user']['passwd']; 6 6 $_SESSION['phpgw_info']['instant_messenger']['name_jabber'] = $GLOBALS['phpgw_info']['server']['name_jabber']; -
trunk/instant_messenger/index.php
r151 r164 30 30 // Footer 31 31 $GLOBALS['phpgw']->common->phpgw_footer(); 32 33 if ( strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') ) 34 exit; 32 35 33 36 ?> … … 38 41 <title>IM</title> 39 42 <!-- JavaScript --> 43 40 44 <script type="text/javascript" src="js/connector.js"></script> 41 45 <script type="text/javascript" src="js/xtools.js"></script> -
trunk/instant_messenger/js/client.js
r151 r164 1 1 var con = new Connector; 2 var disconnected = false; 3 2 4 function client() 3 5 { … … 5 7 var buffer = ''; 6 8 var xtools = new XTools; 7 var disconnected = false; 9 8 10 function request(data) 9 11 { … … 27 29 im_window.elementC('_contacts_im_').innerHTML = xtools.parse(XmlDoc,'disconnected.xsl'); 28 30 func.byId('img_status_im').src = im_unavailable.src; 31 im.status = 'type=unavailable'; 32 im.statusFlag = 'unavailable'; 33 34 //im_window.visible('_contacts_im_','block'); 29 35 } 30 36 else if ( data.lastIndexOf('>') == data.length - 1) … … 53 59 54 60 var node = xmlDoc.documentElement.firstChild; 61 55 62 while ( node ) 63 { 56 64 with ( node ) 57 65 { 58 66 jabber.doIt(nodeName, node); 59 node = nextSibling;67 //node = nextSibling; 60 68 } 69 node = node.nextSibling; 70 } 61 71 } 62 72 else -
trunk/instant_messenger/js/images.js
r151 r164 24 24 im_photo.src = path_im + 'templates/default/images/photo.png'; 25 25 26 var im_photo_1 = new Image(); 27 im_photo_1.src = path_im + 'templates/default/images/photo_1.png'; 28 26 29 var im_group_open = new Image(); 27 30 im_group_open.src = path_im + 'templates/default/images/group_open.gif'; -
trunk/instant_messenger/js/jabber.js
r157 r164 44 44 { 45 45 var XmlDoc = "<layer>" + 46 "<lang1>" + im.get_lang("Nickname") + "</lang1>" +46 "<lang1>" + im.get_lang("Nickname") + "</lang1>" + 47 47 "<lang2>" + im.get_lang("Add Contact") + "</lang2>" + 48 48 "<lang3>" + im.get_lang("Preferences") + "</lang3>" + 49 "<nickname>" + im.get_lang("Username") + "</nickname>" +50 "<path>" +path_im+"</path>" +49 "<nickname>" + im.get_lang("Username") + "</nickname>" + 50 "<path>" + path_im + "</path>" + 51 51 "</layer>"; 52 52 53 im_window.load('_contacts_im_','instant_messenger_content','<title>.::Expresso Messenger::.</title>','window.xsl','',true,true,false); 53 54 im_window.elementC('_contacts_im_').innerHTML = _this.xtools.parse(XmlDoc,'layer.xsl'); 54 55 im_window.elementC('_contacts_im_').innerHTML += _this.xtools.parse(pContacts, 'contacts.xsl'); 55 56 56 57 var element = func.byId('im_contact_list').firstChild; 57 58 … … 67 68 } 68 69 69 if( im.nickname == null)70 { 71 im.request_vcard('this', 'layer');70 if(func.byId('im_avatar').src === im_photo.src) 71 { 72 im.request_vcard('this',false); 72 73 im.ldap_photo('im_avatar'); 73 74 } 74 else75 func.byId('im_layer_nickname').innerHTML = im.nickname;76 75 } 77 76 … … 81 80 { 82 81 case 'contacts' : readContacts(pIq); break; 83 case 'vCard' : readVcard(pIq); break; 82 case 'vCard' : 83 case 'vCard_user' : 84 readVcard(pIq); 85 break; 84 86 } 85 87 } … … 93 95 from = from.substr(0,from.indexOf('/')); 94 96 97 if(func.byId('iframe_' + from) != null) 98 func.byId('iframe_' + from).parentNode.removeChild(func.byId('iframe_' + from)); 99 95 100 var win; 96 if ( !(win = im_window.elementC(from)) ) 97 { 98 im_window.load(from, 'instant_messenger_content', '<title>.:: Expresso Messenger ::.</title>', 'chat.xsl', '310', true, true, true); 99 func.byId(from + '_avatar').src = path_im + "/templates/default/images/photo.png"; 100 101 102 function include_iframe() 103 { 101 104 win = im_window.elementC(from); 102 105 103 106 var iframe = document.createElement('iframe'); 104 107 iframe.id = 'iframe_' + from; … … 108 111 iframe.style.margin = '0'; 109 112 iframe.style.padding = '0' 110 113 111 114 var _messages_ = win.firstChild.firstChild.nextSibling.nextSibling; 112 115 _messages_.appendChild(iframe); 113 116 114 117 iframe.contentWindow.document.write('<html><body id="' + from + '" style="margin:0px;padding:0px"></body></html>'); 115 118 iframe.contentWindow.document.close(); 116 119 iframe.contentWindow.document.designMode = "On"; 117 120 iframe.contentWindow.focus(); 118 121 119 122 function keypress_handler(e) 120 123 { … … 163 166 obj.attachEvent('onkeyup', keyup_handler); 164 167 } 165 }else 168 } 169 170 if ( !(win = im_window.elementC(from)) ) 171 { 172 im_window.load(from, 'instant_messenger_content', '<title>.:: Expresso Messenger ::.</title>', 'chat.xsl', '310', true, true, true); 173 //im_window.visible(from,'block'); 174 func.byId(from + '_avatar').src = path_im + "/templates/default/images/photo.png"; 175 include_iframe(); 176 } 177 else 178 { 166 179 im_window.load(from, '', '', '', '', true, true, true); 180 //im_window.visible(from,'block'); 181 include_iframe(); 182 } 167 183 168 184 if ( win ) 169 185 { 170 186 if(!(im.nickname_contacts[from])) 171 im.request_vcard(from, 'nickname');187 im.request_vcard(from, false); 172 188 173 189 win = win.firstChild.firstChild; … … 183 199 function readPresence(pPresence) 184 200 { 185 var jidFrom = pPresence.getAttribute('from'); 186 jidFrom = jidFrom.substr(0,jidFrom.indexOf('/')); 187 188 if(pPresence.getAttribute('type')) 189 { 190 switch(pPresence.getAttribute('type')) 191 { 192 case 'subscribe' : 193 if(!func.byId(pPresence.getAttribute('from'))) 201 //@TODO: presenca antes da lista ocasiona erros 202 //verificar e retirar o controle de erros abaixo 203 try 204 { 205 var jidFrom = pPresence.getAttribute('from'); 206 jidFrom = jidFrom.substr(0,jidFrom.indexOf('/')); 207 208 if(pPresence.getAttribute('type')) 209 { 210 switch(pPresence.getAttribute('type')) 211 { 212 case 'subscribe' : 213 if(func.byId(pPresence.getAttribute('from'))) 214 { 215 if(confirm('Autorizar o usuário ' + pPresence.getAttribute('from') + '?')) 216 im.subscription(pPresence.getAttribute('from'),'subscribed'); 217 else 218 im.subscription(pPresence.getAttribute('from'),'unsubscribe'); 219 } 220 else 221 { 222 if(!func.byId(pPresence.getAttribute('from'))) 223 { 224 if(confirm('O usuário ' + pPresence.getAttribute('from') + ' quer adicioná-lo ?')) 225 { 226 im.addrequest(pPresence.getAttribute('from')); 227 im.subscription(pPresence.getAttribute('from'),'subscribed'); 228 } 229 else 230 im.subscription(pPresence.getAttribute('from'),'unsubscribe'); 231 }else 232 im.subscription(pPresence.getAttribute('from'),pPresence.getAttribute('type')); 233 } 234 break; 235 case 'subscribed' : 236 im.subscription(pPresence.getAttribute('from'),pPresence.getAttribute('type')); 237 break; 238 case 'unsubscribed' : 239 //alert('O usuário ' + pPresence.getAttribute('from') + ' não quer mais papo !'); 240 break; 241 case 'unsubscribe' : 242 alert('O usuário ' + pPresence.getAttribute('from') + ' negou seu pedido !'); 243 break; 244 case 'unavailable' : 245 func.byId('img_' + jidFrom).src = eval('im_' + pPresence.getAttribute('type') + '.src'); 246 func.confEl(func.byId(jidFrom),"style","margin-left:15px;cursor:pointer;display:none;"); 247 break; 248 case 'available' : 249 func.byId('img_' + jidFrom).src = eval('im_' + pPresence.getAttribute('type') + '.src'); 250 func.confEl(func.byId(jidFrom),"style","margin-left:15px;cursor:pointer;display:block;"); 251 break; 252 } 253 } 254 else 255 { 256 var node = pPresence.firstChild; 257 while( node ) 258 { 259 if(node.hasChildNodes()) 260 { 261 switch(node.nodeName) 194 262 { 195 if(confirm('O usuario ' + pPresence.getAttribute('from') + ' quer adicioná-lo ?')) 196 im.addrequest(pPresence.getAttribute('from')); 197 else 198 im.subscription(pPresence.getAttribute('from'),'unsubscribe'); 199 }else 200 im.subscription(pPresence.getAttribute('from'),pPresence.getAttribute('type')); 201 break; 202 case 'subscribed' : 203 im.subscription(pPresence.getAttribute('from'),pPresence.getAttribute('type')); 204 break; 205 case 'unsubscribed' : 206 //alert('O usuário ' + pPresence.getAttribute('from') + ' não quer mais papo !'); 207 break; 208 case 'unsubscribe' : 209 alert('O usuário ' + pPresence.getAttribute('from') + ' negou seu pedido !'); 210 break; 211 case 'unavailable' : 212 func.byId('img_' + jidFrom).src = eval('im_' + pPresence.getAttribute('type') + '.src'); 213 func.confEl(func.byId(jidFrom),"style","margin-left:15px;cursor:pointer;display:none;"); 214 break; 215 case 'available' : 216 func.byId('img_' + jidFrom).src = eval('im_' + pPresence.getAttribute('type') + '.src'); 217 break; 218 } 219 } 220 else 221 { 222 var node = pPresence.firstChild; 223 while( node ) 224 { 225 if(node.hasChildNodes()) 226 { 227 switch(node.nodeName) 228 { 229 case "show" : 230 func.byId('img_' + jidFrom).src = eval('im_' + node.firstChild.nodeValue + '.src'); 231 func.confEl(func.byId(jidFrom),"style","margin-left:15px;cursor:pointer;display:block;"); 232 func.byId('status_' + jidFrom).innerHTML = " "; 233 func.confEl(func.byId('status_' + jidFrom), "style", "font-size:8pt; font-family:Verdana, Arial, Helvetica, sans-serif; font-style:italic; display:none;"); 234 break; 235 case "status" : 236 func.byId('status_' + jidFrom).innerHTML = ( node.firstChild.nodeValue ) ? node.firstChild.nodeValue : "" ; 237 func.confEl(func.byId('status_' + jidFrom), "style", "font-size:8pt; font-family:Verdana, Arial, Helvetica, sans-serif; font-style:italic; display:block;"); 238 break; 239 default : 240 func.byId('img_' + jidFrom).src = im_available.src; 241 func.confEl(func.byId(jidFrom),"style","margin-left:15px;cursor:pointer;display:block;"); 242 func.byId('status_' + jidFrom).innerHTML = " "; 243 func.confEl(func.byId('status_' + jidFrom), "style", "font-size:8pt; font-family:Verdana, Arial, Helvetica, sans-serif; font-style:italic; display:none;"); 244 break; 263 case "show" : 264 func.byId('img_' + jidFrom).src = eval('im_' + node.firstChild.nodeValue + '.src'); 265 func.confEl(func.byId(jidFrom),"style","margin-left:15px;cursor:pointer;display:block;"); 266 func.byId('status_' + jidFrom).innerHTML = " "; 267 func.confEl(func.byId('status_' + jidFrom), "style", "font-size:8pt; font-family:Verdana, Arial, Helvetica, sans-serif; font-style:italic; display:none;"); 268 break; 269 case "status" : 270 func.byId('status_' + jidFrom).innerHTML = ( node.firstChild.nodeValue ) ? node.firstChild.nodeValue : "" ; 271 func.confEl(func.byId('status_' + jidFrom), "style", "font-size:8pt; font-family:Verdana, Arial, Helvetica, sans-serif; font-style:italic; display:block;"); 272 break; 273 default : 274 func.byId('img_' + jidFrom).src = im_available.src; 275 func.byId('status_' + jidFrom).innerHTML = " "; 276 func.confEl(func.byId('status_' + jidFrom), "style", "font-size:8pt; font-family:Verdana, Arial, Helvetica, sans-serif; font-style:italic; display:none;"); 277 break; 278 } 245 279 } 246 } 247 node = node.nextSibling; 248 } 249 250 /*if(!im.contacts_off_line) 251 setTimeout("im.off_line('none')",2000);*/ 280 node = node.nextSibling; 281 } 282 283 if(!im.contacts_off_line) 284 setTimeout("im.off_line()",3000); 285 } 286 } 287 catch(e) 288 { 252 289 } 253 290 } … … 255 292 function readVcard(pVcard) 256 293 { 257 switch(im.vcard) 258 { 259 case "layer" : 294 switch(pVcard.getAttribute('id')) 295 { 296 case "vCard_user" : 297 260 298 var vcard = pVcard.firstChild; 261 299 var cc = vcard.firstChild; 262 263 300 while( cc ) 264 301 { 265 302 if(cc.nodeName == "NICKNAME" || cc.nodeName == "nickname") 266 303 { 267 func.byId('im_layer_nickname').innerHTML = cc.firstChild.nodeValue;268 im.nickname = " ";269 304 if(cc.firstChild.nodeValue) 270 im.nickname = cc.firstChild.nodeValue;305 func.byId('im_layer_nickname').innerHTML = cc.firstChild.nodeValue; 271 306 } 272 273 307 cc = cc.nextSibling; 274 308 } 275 309 if( im.vcard ) 310 templates.vcard_user(pVcard); 276 311 break; 277 312 278 case "user" : 279 templates.vcard_user(pVcard); 280 im.vcard = "layer"; 281 break; 282 283 case "contact" : 284 templates.vcard_contact(pVcard); 285 im.vcard = "layer"; 286 break; 287 288 case "nickname" : 313 case "vCard" : 314 289 315 var vcard = _this.xtools.parse(pVcard,'nickname.xsl'); 290 im.vcard = "layer"; 291 im.nickname_contacts[vcard.substr(0,vcard.indexOf(','))] = vcard.substr(vcard.indexOf(',')+1); 316 im.nickname_contacts[vcard.substr(0,vcard.indexOf(','))] = ( vcard.substr(vcard.indexOf(',')+1) ) ? vcard.substr(vcard.indexOf(',')+1) : vcard.substr(0,vcard.indexOf(',')) ; 317 if( im.vcard ) 318 templates.vcard_contact(pVcard); 292 319 break; 293 320 } -
trunk/instant_messenger/js/load.js
r151 r164 17 17 }; 18 18 19 function load_im_contacts() 20 { 21 im_window.load('_contacts_im_','instant_messenger_content', '<title>Expresso Messenger</title>', 'window.xsl','',true,true,true); 22 //im_window.visible('_contacts_im_','block'); 23 } 24 19 25 function shortcut_im() 20 26 { … … 22 28 if((local = func.byId('user_info')) && !(func.byId('instant_messenger_content'))) 23 29 { 24 local.innerHTML = '<img src="' + im_fast_menu.src + '" onclick="javascript:templates.fast_menu();"/>' + 25 '<img id="im_status_src" src="' + im_available.src + '" onclick="javascript:im_window.load(\'_contacts_im_\', \'instant_messenger_content\', \'<title>Expresso Messenger</title>\', \'window.xsl\',\'\',true,true,true);"/>' + 26 local.innerHTML + '<div id="instant_messenger_content"><span id="fast_menu_im"/></div>'; 30 var local_old = local.innerHTML ; 31 local.innerHTML = '<img src="' + im_fast_menu.src + '" onclick="javascript:templates.fast_menu();">'; 32 local.innerHTML += '<img id="im_status_src" src="' + im_available.src + '" onclick="javascript:load_im_contacts();"/>'; 33 local.innerHTML += local_old; 34 local.innerHTML += '<div id="instant_messenger_content"></div><span id="fast_menu_im"/>'; 27 35 } 36 28 37 // Carregando Preferências do usuário 29 38 im.get_preferences(); -
trunk/instant_messenger/js/templates.js
r151 r164 26 26 im_window.elementC('add_user_im').innerHTML = this.xtools.parse(XmlDoc,'add_user.xsl'); 27 27 im.ldap(); 28 //im_window.visible('add_user_im','block'); 28 29 }, 29 30 … … 90 91 im_window.elementC('my_settings_im').innerHTML = this.xtools.parse(XmlDoc,'mysettings.xsl'); 91 92 im.get_preferences(); 93 //im_window.visible('my_settings_im','block'); 92 94 }, 93 95 … … 121 123 122 124 if(!(im.nickname_contacts[pJid])) 123 im.request_vcard(pJid, 'nickname');125 im.request_vcard(pJid, false); 124 126 125 127 if(func.byId('img_' + pJid).src != im_unavailable.src ) 126 128 { 127 129 im_window.load(pJid, 'instant_messenger_content', '<title>.:: Expresso Messenger ::.</title>', 'chat.xsl','310',true,true,true); 130 //im_window.visible(pJid,'block'); 128 131 func.byId(pJid + '_avatar').src = path_im + "/templates/default/images/photo.png"; 132 133 if(func.byId('iframe_' + pJid) != null) 134 func.byId('iframe_' + pJid).parentNode.removeChild(func.byId('iframe_' + pJid)); 129 135 130 136 var win = im_window.elementC(pJid); … … 204 210 "<lang2>" + im.get_lang("Group") + "</lang2>" + 205 211 "<lang3>" + im.get_lang("Remove") + "</lang3>" + 206 "<lang4> (Re)-requisitar Autorização</lang4>" +212 "<lang4>" + im.get_lang("It requisition permission")+ "</lang4>" + 207 213 "<lang5>" + im.get_lang("See Info") + "</lang5>" + 208 214 "<jid>" + pJid + "</jid>" + 209 215 "<path>" + path_im + "</path>" + 210 216 "</options>"; 211 menu_action.menu('sub_' + pJid, this.xtools.parse(XmlDoc,'options.xsl')); 212 func.byId('sub_' + pJid).style.zIndex = '99999'; 213 func.byId('sub_' + pJid).style.left = parseInt(func.byId('sub_' + pJid).style.left) - 5; 214 func.byId('sub_' + pJid).style.position = 'absolute'; 215 217 218 var posX = parseInt(func.byId('sub_' + pJid).offsetLeft) - parseInt(func.byId('sub_' + pJid).parentNode.scrollLeft); 219 var posY = parseInt(func.byId('sub_' + pJid).offsetTop) - parseInt(func.byId('sub_' + pJid).parentNode.scrollTop); 220 221 menu_action.menu('im_sub_menu', this.xtools.parse(XmlDoc,'options.xsl')); 222 func.byId('im_sub_menu').style.zIndex = '99999'; 223 func.byId('im_sub_menu').style.top = posY; 224 func.byId('im_sub_menu').style.left = posX + 20; 225 func.byId('im_sub_menu').style.position = 'absolute'; 216 226 }, 217 227 … … 224 234 "<function2>templates.remove_user();</function2>" + 225 235 "<lang3>" + im.get_lang("Vcard") +"</lang3>" + 226 "<function3>im.request_vcard('this', 'user')</function3>" +236 "<function3>im.request_vcard('this',true)</function3>" + 227 237 "<lang4>" + im.get_lang("Preferences") + "</lang4>" + 228 238 "<function4>templates.mysettings()</function4>" + … … 246 256 im_window.elementC('remove_user_im').innerHTML = this.xtools.parse(XmlDoc,'remove_user.xsl'); 247 257 im.get_contacts(); 258 //im_window.visible('remove_user_im','block'); 248 259 }, 249 260 … … 264 275 "vcard_contact" : function(pXml) 265 276 { 277 im.vcard = false; 266 278 var title = "Informações do Contato - Expresso"; 267 279 var XmlDoc = "<vcard_contact>" + … … 279 291 im_window.load('vcard_contact_im','instant_messenger_content','<title>.:: ' + title +' ::.</title>','window.xsl','390',true,true,true); 280 292 im_window.elementC('vcard_contact_im').innerHTML = this.xtools.parse(XmlDoc,'vcard_contacts.xsl'); 293 //im_window.visible('vcard_contact_im','block'); 281 294 }, 282 295 283 296 "vcard_user" : function(pXml) 284 297 { 298 im.vcard = false; 285 299 var title = "Informações Pessoais - Expresso"; 286 300 var XmlDoc = "<vcard_user>" + … … 298 312 im_window.load('vcard_user_im','instant_messenger_content','<title>.:: ' + title +' ::.</title>','window.xsl','470',true,true,true); 299 313 im_window.elementC('vcard_user_im').innerHTML = this.xtools.parse(XmlDoc,'vcard_user.xsl'); 314 //im_window.visible('vcard_user_im','block'); 300 315 } 301 316 } -
trunk/instant_messenger/templates/default/config.tpl
r151 r164 13 13 14 14 <tr bgcolor="{row_off}"> 15 <td colspan="2"> <b>Configura ção do Servidor Jabber</b></td>15 <td colspan="2"> <b>Configuraçãoo do Servidor Jabber</b></td> 16 16 </tr> 17 17 18 18 <tr bgcolor="{row_on}"> 19 <td>Digite o nome da m áquina Servidor Jabber:</td>19 <td>Digite o nome da máquina Servidor Jabber:</td> 20 20 <td><input id="IM_name_jabber" name="newsettings[name_jabber]" value="{value_name_jabber}"></td> 21 21 </tr> 22 22 23 23 <tr bgcolor="{row_off}"> 24 <td>Digite Nome da Conex ão:</td>24 <td>Digite Nome da Conexão:</td> 25 25 <td><input id="IM_resource_jabber" name="newsettings[resource_jabber]" value="{value_resource_jabber}"></td> 26 26 </tr> … … 42 42 43 43 <tr bgcolor="{row_off}"> 44 <td>Usu ário Ldap:</td>44 <td>Usuário Ldap:</td> 45 45 <td><input id="IM_user_ldap_jabber" name="newsettings[user_ldap_jabber]" value="{value_user_ldap_jabber}" size="30"></td> 46 46 </tr> -
trunk/instant_messenger/templates/default/index.tpl
r151 r164 28 28 <br> 29 29 ( figura 1 ) 30 <img src="templates/default/images/lista_contatos.png" width="20 5" height="233" alt="Im Screenshot" align="left" style="padding-right:4px;">30 <img src="templates/default/images/lista_contatos.png" width="200" height="319" alt="Im Screenshot" align="left" style="padding-right:4px;"> 31 31 32 32 <br clear="all"> … … 34 34 <h2><a name="acesso_primeiro">2. Acessando o Expresso Messenger pela Primeira Vez</a></h2> 35 35 36 Para o acessar o Expresso Messenger, basta clicar em cima da figura <img src="templates/default/images/available.gif">("bolinha verde"), abrirá uma uma janela igual a figura 2. A lista de contatos aparecerá com a seguinte frase : "Nenhum Contato", at éque sejam cadastrados novos contatos.36 Para o acessar o Expresso Messenger, basta clicar em cima da figura <img src="templates/default/images/available.gif">("bolinha verde"), abrirá uma uma janela igual a figura 2. A lista de contatos aparecerá com a seguinte frase : "Nenhum Contato", atá que sejam cadastrados novos contatos. 37 37 38 38 <br clear="all"> 39 39 <br> 40 40 ( figura 2 ) 41 <img src="templates/default/images/lista_contatos_primeira.png" width="20 6" height="233" alt="Im Screenshot" align="left" style="padding-right:4px;">41 <img src="templates/default/images/lista_contatos_primeira.png" width="201" height="318" alt="Im Screenshot" align="left" style="padding-right:4px;"> 42 42 43 43 <br clear="all"> … … 48 48 <b>Windows XP/2000/ME/98/95:</b> 49 49 <ul> 50 < li>MS Internet Explorer desde a versão 6.0</li>50 <!--li>MS Internet Explorer desde a versão 6.0</li--> 51 51 <li>Mozilla Firefox desde a versão 1.5</li> 52 52 </ul> … … 61 61 <h2><a name="prefe">4. Menu Opções</a></h2> 62 62 ( figura 3 ) 63 <img src="templates/default/images/menu_preferencias.png" width="20 7" height="234" alt="Menu Preferências" align="left">63 <img src="templates/default/images/menu_preferencias.png" width="201" height="320" alt="Menu Preferências" align="left"> 64 64 <br clear="all"> 65 65 <br> … … 89 89 <br> 90 90 91 Para adici onar um novo contato ( conforme figura 4.1 ), selecione uma organização e automaticamente carregará os usuários que tem permissão para usar o Mensageiro Instantâneo Expresso. Para escolher92 seu novo contato basta apenas dar um clique em cima do nome desejado. Logo abaixo, três campos são necessários para adicionar o novo contato, sendo que o campo "Email Expresso" e91 Para adicinar um novo contato, clique na imagem <img src="templates/default/images/addBuddy1.gif"/> e abrirá uma janela ( conforme figura 4.1 ) selecione uma organização e automaticamente carregará os usuários que tem permissão para usar o Mensageiro Instantâneo Expresso. 92 Para escolher seu novo contato basta apenas dar um clique em cima do nome desejado. Logo abaixo, três campos são necessários para adicionar o novo contato, sendo que o campo "Email Expresso" e 93 93 "Nickname" são preenchidos no momento da escolha do novo contato e o campo grupo terá que ser definido. Tendo os três campos preenchidos basta clicar no Botão Adicionar ( <input type="button" value="Adicionar"> ) . 94 94 … … 100 100 <br> 101 101 102 Para remover um contato da sua lista ( conforme figura 4.2 ), selecione na lista e clique no botao Bot ão Remover ( <input type="button" value="Remover"> ) .102 Para remover um contato da sua lista ( conforme figura 4.2 ), selecione na lista e clique no botao Botï¿œo Remover ( <input type="button" value="Remover"> ) . 103 103 104 104 <h2><a name="menu_right">6. Preferências Avançadas</a></h2> 105 105 ( figura 4.3 ) 106 106 <br/> 107 <img src="templates/default/images/menu_right.png" width="212" height="126" alt="Prefer ências Avançadas" align="left">107 <img src="templates/default/images/menu_right.png" width="212" height="126" alt="Preferï¿œncias Avanï¿œadas" align="left"> 108 108 <br clear="all"/> 109 109 <br/> … … 138 138 <h2><a name="troca_mens">9. Troca de Mensagens</a></h2> 139 139 ( figura 7 ) 140 <img src="templates/default/images/troca_mensagem.png" width="31 9" height="314" alt="Troca de Mensagens" align="left">140 <img src="templates/default/images/troca_mensagem.png" width="311" height="308" alt="Troca de Mensagens" align="left"> 141 141 <br clear="all"/> 142 142 <br/> 143 143 144 144 Clicando com o mouse em cima do nome do contato escolhido, abrirá uma janela ( conforme figura 7 ), para a troca de mensagens. Nessa mesma janela existe um menu, o qual é possível 145 configurar o formato da Fonte como : <b>Negrito</b>, <i>Itálico</i> e a cor. Você também pode enviar os Smiles, clicando nessa figura <img src="templates/default/images/emoticonlabel.gif">. 145 configurar o formato da Fonte como : <b>Negrito</b>, <i>Itálico</i> e a cor. Você também pode enviar os Smiles, clicando em <img src="templates/default/images/emoticonlabel.gif"> 146 e acessar as informações do contato clicando em <img src="templates/default/images/profileBuddy.gif">. 146 147 147 148 <h2><a name="troca_status">10. Troca de Status</a></h2> -
trunk/instant_messenger/xsl/chat.xsl
r161 r164 26 26 <div style="margin:3px 3px;"> 27 27 <div class="history"> 28 <div class="avatar" style="margin: 2px;">29 <img id="{name}_avatar"/>30 28 <div class="avatar" style="margin: 2px; position: absolute; right: 30px; top: 30px;"> 29 <img id="{name}_avatar"/> 30 </div> 31 31 </div> 32 32 <div class="toolbar_buttons"> … … 36 36 <div id="{name}_button_color" class="button_color" onclick="javascript:im.conf_font('{name}','button_color');"></div> 37 37 <div id="{name}_button_emoticons" class="button_emoticons" onclick="javascript:im.conf_font('{name}','button_emoticons');"></div> 38 <div id="{name}_button_profile" class="button_profile" onclick="im.request_vcard('{name}','contact');"></div> 38 39 <div id="{name}_button_dest"></div> 39 40 </div> -
trunk/instant_messenger/xsl/contacts.xsl
r151 r164 13 13 <xsl:choose> 14 14 <xsl:when test="not(group = preceding-sibling::item/group)"> 15 <img id="group_{group[current()]}" src=" /instant_messenger/templates/default/images/group_open.gif" onclick="javascript:im.group_close('{group[current()]}');"/>15 <img id="group_{group[current()]}" src="instant_messenger/templates/default/images/group_open.gif" onclick="javascript:im.group_close('{group[current()]}');"/> 16 16 <b><xsl:value-of select="group[current()]" /><br/></b> 17 17 <xsl:apply-templates select="." mode="contacts"/> … … 30 30 <xsl:when test="@name"> 31 31 <div style="margin-left:15px;cursor:pointer;display:block;" id="{@jid}" idgroup="{group}" idname="{@name}" onmousedown="templates.options(event, '{@jid}');"> 32 <img id="img_{@jid}" src=" /instant_messenger/templates/default/images/unavailable.gif" style="margin:0px 2px" />32 <img id="img_{@jid}" src="instant_messenger/templates/default/images/unavailable.gif" style="margin:0px 2px" /> 33 33 <xsl:value-of select="@name"/> 34 34 <br/> 35 35 <span id="status_{@jid}" style="font-size:8pt; font-family:Verdana, Arial, Helvetica, sans-serif; font-style:italic; display:none" /> 36 36 </div> 37 < div id="sub_{@jid}"></div>37 <span id="sub_{@jid}"></span> 38 38 </xsl:when> 39 39 <xsl:otherwise> 40 40 <div style="margin-left:15px;cursor:pointer;display:block;" id="{@jid}" idgroup="{group}" idname="" onmousedown="templates.options(event, '{@jid}');"> 41 <img id="img_{@jid}" src=" /instant_messenger/templates/default/images/unavailable.gif" style="margin:0px 2px" />41 <img id="img_{@jid}" src="instant_messenger/templates/default/images/unavailable.gif" style="margin:0px 2px" /> 42 42 <xsl:value-of select="@jid"/> 43 43 <br/> 44 44 <span id="status_{@jid}" style="font-size:8pt; font-family:Verdana, Arial, Helvetica, sans-serif; font-style:italic; display:none;" /> 45 45 </div> 46 < div id="sub_{@jid}"></div>46 <span id="sub_{@jid}"></span> 47 47 </xsl:otherwise> 48 48 </xsl:choose> -
trunk/instant_messenger/xsl/disconnected.xsl
r151 r164 13 13 <br/> 14 14 <div style="margin:5px"> 15 Sua conexão com o 15 Sua conexão com o 16 16 <br/> 17 17 Servidor parou. … … 26 26 <br/> 27 27 <img src="{path}templates/default/images/available.gif" /> 28 <a href="javascript: client();"><font style="font-size:7pt;margin:2px">Reconectar ...</font></a>28 <a href="javascript:disconnected = false; client();"><font style="font-size:7pt;margin:2px">Reconectar ...</font></a> 29 29 </div> 30 30 </xsl:template> -
trunk/instant_messenger/xsl/layer.xsl
r151 r164 11 11 </td> 12 12 <td style="valign:top"> 13 < xsl:value-of select="lang1" /> :13 <span style="font-weight:bold;"><xsl:value-of select="lang1" /> : </span> 14 14 <br></br> 15 <span id="im_layer_nickname"><xsl:value-of select="nickname" /></span> 15 <span id="im_layer_nickname"><xsl:value-of select="nickname" /></span> 16 16 <br></br> 17 17 <br></br> 18 <span onclick="javascript:templates.add_user();" style="cursor:pointer;"><u><xsl:value-of select="lang2"/></u></span> 19 <br></br> 20 <br></br> 21 <span onclick="javascript:templates.preferences('span_teste');" style="cursor:pointer;"><u><xsl:value-of select="lang3"/></u></span> 22 <span id="span_teste"></span> 18 <img src="{path}templates/default/images/addBuddy1.gif" style="cursor:pointer;" onclick="javascript:templates.add_user();" title="{lang2}" alt="{lang2}"/> 19 <img src="{path}templates/default/images/console_prefs1.png" style="cursor:pointer;" onclick="javascript:templates.preferences('span_preferences');" title="{lang3}" alt="{lang3}"/> 20 <span id="span_preferences"></span> 23 21 <br></br> 24 22 </td> -
trunk/instant_messenger/xsl/window.xsl
r151 r164 28 28 </div> 29 29 <div id="{name}_window_bottom" class="rodape" dragdrop="false"></div> 30 <div id="im_sub_menu"></div> 30 31 </div> 31 32 </xsl:template>
Note: See TracChangeset
for help on using the changeset viewer.