示例#1
0
文件: db.py 项目: zz2/ihere
def leave_channel(nickname, channel_id=None):
    keys = []
    if channel_id is not None and channel_id in keys:
        keys = [channel_id]
    if channel_id is None:
        keys = get_active_channels()
    for key in keys:
        if r_db.sismember(key, nickname):
            r_db.srem(key, nickname)
示例#2
0
文件: db.py 项目: zz2/ihere
def join_channel(nickname, channel_id):
    key = id2channel_mem_key(channel_id)
    if not r_db.sismember(key, nickname):
        leave_channel(nickname)
        r_db.sadd(key, nickname)