[FIX] Removed unnecessary files.
bzr revid: noz@tinyerp.com-20110412042231-ualx3l5s4po6wka7
This commit is contained in:
@@ -144,7 +144,6 @@ class PollServer(openerpweb.Controller):
|
||||
msg = '[]'
|
||||
time.sleep(1)
|
||||
|
||||
# it's http://localhost:8002/web_chat/pollserver/poll?callback=jsonp1302147330483&_1302147330483=
|
||||
return '%s'%kw.get('callback', '') + '(' + str(msg) + ');'
|
||||
|
||||
@openerpweb.httprequest
|
||||
@@ -210,7 +209,7 @@ class PollServer(openerpweb.Controller):
|
||||
msg_arr = []
|
||||
for msg in messages:
|
||||
msg_arr.append({"t": str(msg['type']), "s": str(msg['from']), "r": str(msg['to']), "m": str(msg['message'])})
|
||||
|
||||
|
||||
return msg_arr
|
||||
|
||||
def _sanitize(self, message):
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
|
||||
import im
|
||||
from server import main # import the server library
|
||||
|
||||
im = Webchat_IM()
|
||||
action = preg_replace('/^' . preg_quote($_SERVER['SCRIPT_NAME'], '/') . '\/(.+?)(\?.+)?$/', '\1', $_SERVER['REQUEST_URI']);
|
||||
|
||||
if(substr(action, 0, 1) != '_' && method_exists(im, action))
|
||||
if(action == 'poll') {
|
||||
if($_GET['method'] == 'comet') {
|
||||
im->poll('comet');
|
||||
} else {
|
||||
print $_GET['callback'] . '(' . json_encode(im->poll($_GET['method'])) . ')';
|
||||
}
|
||||
} else {
|
||||
execute = call_user_func_array(array(im, action), $_POST);
|
||||
if(execute)
|
||||
print json_encode(execute !== false ? execute : array('e'=>'wrong args'));
|
||||
}
|
||||
else
|
||||
print json_encode(array('e'=>'no method'));
|
||||
@@ -1,22 +0,0 @@
|
||||
|
||||
import openerpweb
|
||||
|
||||
class IM(openerpweb.Controller):
|
||||
def __init__(self):
|
||||
super(IM, self).__init__()
|
||||
return;
|
||||
|
||||
def chat_login(self, username, password):
|
||||
return dict()
|
||||
|
||||
def chat_logout(self):
|
||||
return dict()
|
||||
|
||||
def send(self):
|
||||
return dict()
|
||||
|
||||
def status(self, status, message):
|
||||
return dict()
|
||||
|
||||
def poll(self, method):
|
||||
return dict()
|
||||
@@ -1,61 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import simplejson
|
||||
import openerpweb
|
||||
|
||||
from web_chat.controllers import im
|
||||
|
||||
__all__ = ['Webchat_IM']
|
||||
|
||||
chat_config_options = {'IM_LIBRARY': 'main', # The IM server library.
|
||||
'COOKIE_NAME': 'ajaxim_session', # Session cookie used by Ajax IM
|
||||
'COOKIE_PERIOD': 365 # Cookie period, in days
|
||||
}
|
||||
|
||||
nodejs_memcache_server = ['localhost:11211']
|
||||
|
||||
class Webchat_IM(im.IM):
|
||||
|
||||
_cp_path = "/webchat/webchatim"
|
||||
|
||||
def __init__(self):
|
||||
super(Webchat_IM, self).__init__()
|
||||
|
||||
return;
|
||||
|
||||
@openerpweb.jsonrequest
|
||||
def index(self, req, username="admin", password="admin"):
|
||||
|
||||
if req._login:
|
||||
self.username = req._login
|
||||
self.uid = req._uid
|
||||
self.db = req._db
|
||||
|
||||
return;
|
||||
|
||||
@openerpweb.jsonrequest
|
||||
def chat_login(self, req, username="admin", password="admin"):
|
||||
# TODO: use db and uid for unique identification.
|
||||
|
||||
self.auth = [['admin', 'a'], ['demo', 'demo']]
|
||||
|
||||
self.user_pass = []
|
||||
self.user_session = None
|
||||
|
||||
if username and password:
|
||||
self.user_pass = [username, password]
|
||||
|
||||
if self.user_pass in self.auth:
|
||||
self.user_session = username + '_' + str(req.session_id)
|
||||
|
||||
data = {'username': username, 'user_id': username, 'user_session': self.user_session,
|
||||
'friends': {'u': 'demo', 'g': 'Friends', 's': '1'} # {'u': 'username', 'g': 'group', 's': 'status'}
|
||||
}
|
||||
|
||||
# Get the list of friends from memcache.
|
||||
|
||||
return dict(r='logged in', s=self.user_session, f=data['friends'])
|
||||
|
||||
@openerpweb.jsonrequest
|
||||
def chat_logout(self):
|
||||
return dict(r='Logged out')
|
||||
Reference in New Issue
Block a user