"; exit; } function show_error($message) { start_xml_output(); echo "$message"; exit; } ping_thread($thread, $isuser,$istyping); if( !$isuser && $act != "rename" ) { $operator = check_login(); check_for_reassign($thread,$operator); } if( $act == "refresh" ) { $lastid = verifyparam( "lastid", "/^\d{1,9}$/", -1); print_thread_messages($thread, $token, $lastid, $isuser,$outformat, $isuser ? null : $operator['operatorid']); exit; } else if( $act == "post" ) { $lastid = verifyparam( "lastid", "/^\d{1,9}$/", -1); $message = getrawparam('message'); $kind = $isuser ? $kind_user : $kind_agent; $from = $isuser ? $thread['userName'] : $thread['agentName']; if(!$isuser && $operator['operatorid'] != $thread['agentId']) { show_error("cannot send"); } $link = connect(); $postedid = post_message_($threadid,$kind,$message,$link,$from,null,$isuser ? null : $operator['operatorid'] ); if($isuser && $thread["shownmessageid"] == 0) { commit_thread( $thread['threadid'], array('shownmessageid' => $postedid), $link); } mysql_close($link); print_thread_messages($thread, $token, $lastid, $isuser, $outformat, $isuser ? null : $operator['operatorid']); exit; } else if( $act == "rename" ) { loadsettings(); if( $settings['usercanchangename'] != "1" ) { show_error("server: forbidden to change name"); } $newname = getrawparam('name'); rename_user($thread, $newname); $data = strtr(base64_encode(myiconv($webim_encoding,"utf-8",$newname)), '+/=', '-_,'); setcookie($namecookie, $data, time()+60*60*24*365); show_ok_result("rename"); } else if( $act == "ping" ) { show_ok_result("ping"); } else if( $act == "close" ) { if( $isuser || $thread['agentId'] == $operator['operatorid']) { close_thread($thread, $isuser); } show_ok_result("closed"); } ?>