Beispiel #1
0
            def headCb(payload):
                req.result = id

                if uid:
                    log.push("%s/head" % uid, simplejson.dumps({"type": type, "params": params, "body": safeBody}))

                res.callback(None)
Beispiel #2
0
            def headCb(payload):
                req.result = id

                if uid:
                    log.push(
                        "%s/head" % uid,
                        simplejson.dumps({
                            'type': type,
                            'params': params,
                            'body': safeBody
                        }))

                res.callback(None)
Beispiel #3
0
                def broadcastCb(payload):
                    if puid:
                        def uidCb(payload):
                            res.callback(None)

                        if puid:
                            log.push("%s/reply" % uid, simplejson.dumps({'reply': broadcast['tail'][0]}))
                        
                        d4 = comm.broadcast('/user/' + puid, simplejson.dumps({'reply': broadcast}))
                        d4.addCallback(uidCb)
                                    
                    else:
                        res.callback(None)
Beispiel #4
0
            def tailCb(payload):
                if payload:
                    payload = simplejson.loads(payload)

                broadcast = {
                    'tail': [{
                        'id': id,
                        'parent': pid,
                        'uid': uid,
                        'lid': lid,
                        'user': user,
                        'type': type,
                        'params': params,
                        'body': safeBody,
                        'time': time
                    }],
                    'users': [payload]
                }

                def broadcastCb(payload):
                    if puid:

                        def uidCb(payload):
                            res.callback(None)

                        if puid:
                            log.push(
                                "%s/reply" % uid,
                                simplejson.dumps(
                                    {'reply': broadcast['tail'][0]}))

                        d4 = comm.broadcast(
                            '/user/' + puid,
                            simplejson.dumps({'reply': broadcast}))
                        d4.addCallback(uidCb)

                    else:
                        res.callback(None)

                if uid:
                    log.push("%s/tail" % uid,
                             simplejson.dumps({'tail': broadcast['tail'][0]}))

                d3 = comm.broadcast('/chan/tail_' + lid,
                                    simplejson.dumps({'broadcast': broadcast}))
                d3.addCallback(broadcastCb)
Beispiel #5
0
                def broadcastCb(payload):
                    if puid:

                        def uidCb(payload):
                            res.callback(None)

                        if puid:
                            log.push(
                                "%s/reply" % uid,
                                simplejson.dumps(
                                    {'reply': broadcast['tail'][0]}))

                        d4 = comm.broadcast(
                            '/user/' + puid,
                            simplejson.dumps({'reply': broadcast}))
                        d4.addCallback(uidCb)

                    else:
                        res.callback(None)
Beispiel #6
0
            def tailCb(payload):
                if payload:
                    payload = simplejson.loads(payload)

                broadcast = {
                    'tail' : [{
                        'id' : id,
                        'parent' : pid,
                        'uid' : uid,
                        'lid' : lid,
                        'user' : user,
                        'type' : type,
                        'params' : params,
                        'body' : safeBody,
                        'time' : time
                    }],

                    'users' : [payload]
                }
                
                def broadcastCb(payload):
                    if puid:
                        def uidCb(payload):
                            res.callback(None)

                        if puid:
                            log.push("%s/reply" % uid, simplejson.dumps({'reply': broadcast['tail'][0]}))
                        
                        d4 = comm.broadcast('/user/' + puid, simplejson.dumps({'reply': broadcast}))
                        d4.addCallback(uidCb)
                                    
                    else:
                        res.callback(None)

                if uid:
                    log.push("%s/tail" % uid, simplejson.dumps({'tail': broadcast['tail'][0]}))
                        
                d3 = comm.broadcast('/chan/tail_' + lid, simplejson.dumps({'broadcast': broadcast}))
                d3.addCallback(broadcastCb)