def cb_iro(md, type, tid, params, sbd): "Handles the switchboard participant list" p = params.split(' ') uid, ucount, email, nick = p if ucount == '1': # do nothing if we only have one participant return else: if email not in md.users.keys(): md.users[email] = msnlib.user(email) if email not in sbd.emails: sbd.emails.append(email)
def cb_joi(md, type, tid, params, sbd): "Handles a switchboard join, and sends the pending messages" email = tid # if it's a multi-user chat, just append it to the list if sbd.emails and email != sbd.emails[0]: sbd.emails.append(email) if email not in md.users.keys(): md.users[email] = msnlib.user(email) #debug('CALL: user %s joined chat with %s' % \ #(email, sbd.emails[0])) # otherwise (common path) set up the sbd and flush the messages else: sbd.state = 'es' #debug('CALL: user %s replied your chat request; flushing' % email) md.sendmsg(email)
def cb_lst(md, type, tid, params): p = params.split(' ') email = tid nick = urllib.unquote(p[0]) listmask = int(p[1]) if len(p) == 3: groups = p[2] else: groups = '0' # we only use one main group id gid = groups.split(',')[0] if email in md.users.keys(): user = md.users[email] else: user = msnlib.user(email, nick, gid) # the list mask is a bitmask, composed of: # FL: 1 # AL: 2 # BL: 4 # RL: 8 # in forward if listmask & 1: user.lists.append('F') md.users[email] = user # in reverse if listmask & 8: user.lists.append('R') md.reverse[email] = user # in allow if listmask & 2: user.lists.append('A') # in block if listmask & 4: user.lists.append('B') md.lst_total += 1 # save in the global last_lst the email, because BPRs might need it md._last_lst = email
def cb_add(md, type, tid, params): "Handles a user add; both you adding a user and a user adding you" t = params.split(' ') type = t[0] if type == 'RL': email = t[2] nick = urllib.unquote(t[3]) debug('ADD: %s (%s) added you' % (nick, email)) elif type == 'FL': email = t[2] nick = urllib.unquote(t[3]) gid = t[4] md.users[email] = msnlib.user(email, nick, gid) # put None in last_lst so BPRs know it's not coming from sync md._last_lst = None debug('ADD: adding %s (%s)' % (email, nick)) else: pass