示例#1
0
    def doFriendsImages(bunch, text, env):
        userid = loggedIn(env)
        if not userid:
            return "Can't show you your friends images - you're not logged in!"

        contacts = getContacts(userid)
        if not contacts:
            return "Sorry - I can't show you any images from your friends - maybe you haven't added any contacts?"

        user_images = ContactsImages(contacts)
        if user_images == []:
            return "Your friends haven't uploaded any images yet! Get them to do something!"

        images = []
        i = 0
        for image in user_images:
            i = i + 1
            if i % 4 == 0:
                image["extra"] = " last"
            else:
                image["extra"] = ""
            image = image_template % image
            if i % 4 == 0:
                image += '<div class="divide"></div>'
            images.append(image)
        return "".join(images) + '<div class="divide"></div>'
示例#2
0
    def dofriendslist(bunch, text, env):
        if loggedIn(env):
            myid = loggedIn(env)

            contacts = getContacts(myid)
            if not contacts:
                return text

            users = ["<ul>"]
            for user in getRegistrations(contacts):
                user["email"] = user["email"][user["email"].find("@") + 1 :]
                users.append("<li> <B>%(screenname)s</b> ( %(email)s )" % user)
            users.append("</ul>")

            return "\n".join(users)
        else:
            return "Sorry, in order to have a contact/friends list, you must be logged in!"