Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a way to get the MSGFLAG's from the bitwise built PR_MESSAGE_FLAGS #28

Open
bkram opened this issue Jul 16, 2015 · 1 comment
Open

Comments

@bkram
Copy link
Contributor

bkram commented Jul 16, 2015

For instance when a PR_MESSAGE_FLAGS contains 17 (0x11L)

This should return [MSGFLAG_HASATTACH, MSGFLAG_READ]

@bkram
Copy link
Contributor Author

bkram commented Jul 16, 2015

For now I have created a workaround

def get_pr_message_flags(pr_message_flags):

    flags = []
    msgflags = [('MSGFLAG_READ', 0x0001), ('MSGFLAG_UNMODIFIED', 0x0002), ('MSGFLAG_SUBMIT', 0x0004),
                ('MSGFLAG_UNSENT', 0x0008), ('MSGFLAG_HASATTACH', 0x0010), ('MSGFLAG_FROMME', 0x0020),
                ('MSGFLAG_ASSOCIATED', 0x0040), ('MSGFLAG_RESEND', 0x0080), ('MSGFLAG_RN_PENDING', 0x0100),
                ('MSGFLAG_NRN_PENDING', 0x0200)]

    while len(msgflags) > 0:

        flag = msgflags.pop()

        if pr_message_flags - flag[1] >= 0:
            pr_message_flags -= flag[1]
            flags.append(flag[0])

    return flags

print get_pr_message_flags(0x3FF)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant