'Allows the user to activate/deactivate the communication server.'

@expose_api
def set_communication(self, trans, id, payload={}, **kwd):

    user = self._get_user(trans, id)
    enable = payload.get('enable', 'false')
    if (enable == 'true'):
        message = 'Your    communication    server    has    been    activated.'
    else:
        message = 'Your    communication    server    has    been    disabled.'
    user.preferences['communication_server'] = enable
    trans.sa_session.add(user)
    trans.sa_session.flush()
    return {'message': message}
