예제 #1
0
def handleChatRoomAdded(chatroom, event):
    """ Register the chatroom with the messaging service.
    """
    getMultiAdapter((chatroom, chatroom.REQUEST), name='babblechat').initialize()
    pm = getToolByName(chatroom, 'portal_membership')
    member = pm.getAuthenticatedMember()
    password = _getChatPassword(member)
    if password is None:
        return

    s = get_connection(chatroom)
    try:
        result = json.loads(s.createChatRoom(
                                    member.getId(), 
                                    password, 
                                    '/'.join(chatroom.getPhysicalPath()), 
                                    get_participants(chatroom),
                                    ))
    except xmlrpclib.Fault, e:
        log.error('XMLRPC Error from babble.server: createChatRoom: %s' % e)
        return 
예제 #2
0
def _editChatRoom(chatroom):
    pm = getToolByName(chatroom, 'portal_membership')
    member = pm.getAuthenticatedMember()
    password = _getChatPassword(member)
    if password is None:
        return
            
    chatroom_path = '/'.join(chatroom.getPhysicalPath())
    s = get_connection(chatroom)
    participants = get_participants(chatroom)
    try:
        resp = json.loads(
                    s.editChatRoom(
                            member.getId(), 
                            password, 
                            chatroom_path, 
                            participants,
                    ))
    except xmlrpclib.Fault, e:
        err_msg = e.faultString.strip('\n').split('\n')[-1]
        log.error('Error from babble.server: editChatRoom: %s' % err_msg)
        return