/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/util/simplemapi.py

  • Committer: Jelmer Vernooij
  • Date: 2018-05-06 11:48:54 UTC
  • mto: This revision was merged to the branch mainline in revision 6960.
  • Revision ID: jelmer@jelmer.uk-20180506114854-h4qd9ojaqy8wxjsd
Move .mailmap to root.

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
LPLHANDLE = POINTER(LHANDLE)
47
47
 
48
48
# Return codes
49
 
SUCCESS_SUCCESS = 0
50
 
MAPI_USER_ABORT = 1
51
 
MAPI_E_USER_ABORT = MAPI_USER_ABORT
52
 
MAPI_E_FAILURE = 2
53
 
MAPI_E_LOGON_FAILURE = 3
54
 
MAPI_E_LOGIN_FAILURE = MAPI_E_LOGON_FAILURE
55
 
MAPI_E_DISK_FULL = 4
56
 
MAPI_E_INSUFFICIENT_MEMORY = 5
57
 
MAPI_E_ACCESS_DENIED = 6
58
 
MAPI_E_TOO_MANY_SESSIONS = 8
59
 
MAPI_E_TOO_MANY_FILES = 9
60
 
MAPI_E_TOO_MANY_RECIPIENTS = 10
61
 
MAPI_E_ATTACHMENT_NOT_FOUND = 11
62
 
MAPI_E_ATTACHMENT_OPEN_FAILURE = 12
 
49
SUCCESS_SUCCESS                 = 0
 
50
MAPI_USER_ABORT                 = 1
 
51
MAPI_E_USER_ABORT               = MAPI_USER_ABORT
 
52
MAPI_E_FAILURE                  = 2
 
53
MAPI_E_LOGON_FAILURE            = 3
 
54
MAPI_E_LOGIN_FAILURE            = MAPI_E_LOGON_FAILURE
 
55
MAPI_E_DISK_FULL                = 4
 
56
MAPI_E_INSUFFICIENT_MEMORY      = 5
 
57
MAPI_E_ACCESS_DENIED            = 6
 
58
MAPI_E_TOO_MANY_SESSIONS        = 8
 
59
MAPI_E_TOO_MANY_FILES           = 9
 
60
MAPI_E_TOO_MANY_RECIPIENTS      = 10
 
61
MAPI_E_ATTACHMENT_NOT_FOUND     = 11
 
62
MAPI_E_ATTACHMENT_OPEN_FAILURE  = 12
63
63
MAPI_E_ATTACHMENT_WRITE_FAILURE = 13
64
 
MAPI_E_UNKNOWN_RECIPIENT = 14
65
 
MAPI_E_BAD_RECIPTYPE = 15
66
 
MAPI_E_NO_MESSAGES = 16
67
 
MAPI_E_INVALID_MESSAGE = 17
68
 
MAPI_E_TEXT_TOO_LARGE = 18
69
 
MAPI_E_INVALID_SESSION = 19
70
 
MAPI_E_TYPE_NOT_SUPPORTED = 20
71
 
MAPI_E_AMBIGUOUS_RECIPIENT = 21
72
 
MAPI_E_AMBIG_RECIP = MAPI_E_AMBIGUOUS_RECIPIENT
73
 
MAPI_E_MESSAGE_IN_USE = 22
74
 
MAPI_E_NETWORK_FAILURE = 23
75
 
MAPI_E_INVALID_EDITFIELDS = 24
76
 
MAPI_E_INVALID_RECIPS = 25
77
 
MAPI_E_NOT_SUPPORTED = 26
 
64
MAPI_E_UNKNOWN_RECIPIENT        = 14
 
65
MAPI_E_BAD_RECIPTYPE            = 15
 
66
MAPI_E_NO_MESSAGES              = 16
 
67
MAPI_E_INVALID_MESSAGE          = 17
 
68
MAPI_E_TEXT_TOO_LARGE           = 18
 
69
MAPI_E_INVALID_SESSION          = 19
 
70
MAPI_E_TYPE_NOT_SUPPORTED       = 20
 
71
MAPI_E_AMBIGUOUS_RECIPIENT      = 21
 
72
MAPI_E_AMBIG_RECIP              = MAPI_E_AMBIGUOUS_RECIPIENT
 
73
MAPI_E_MESSAGE_IN_USE           = 22
 
74
MAPI_E_NETWORK_FAILURE          = 23
 
75
MAPI_E_INVALID_EDITFIELDS       = 24
 
76
MAPI_E_INVALID_RECIPS           = 25
 
77
MAPI_E_NOT_SUPPORTED            = 26
78
78
# Recipient class
79
 
MAPI_ORIG = 0
80
 
MAPI_TO = 1
 
79
MAPI_ORIG       = 0
 
80
MAPI_TO         = 1
81
81
# Send flags
82
 
MAPI_LOGON_UI = 1
83
 
MAPI_DIALOG = 8
84
 
 
 
82
MAPI_LOGON_UI   = 1
 
83
MAPI_DIALOG     = 8
85
84
 
86
85
class MapiRecipDesc(Structure):
87
86
    _fields_ = [
88
 
        ('ulReserved', c_ulong),
89
 
        ('ulRecipClass', c_ulong),
90
 
        ('lpszName', c_char_p),
91
 
        ('lpszAddress', c_char_p),
92
 
        ('ulEIDSize', c_ulong),
93
 
        ('lpEntryID', c_void_p),
 
87
        ('ulReserved',      c_ulong),
 
88
        ('ulRecipClass',    c_ulong),
 
89
        ('lpszName',        c_char_p),
 
90
        ('lpszAddress',     c_char_p),
 
91
        ('ulEIDSize',       c_ulong),
 
92
        ('lpEntryID',       c_void_p),
94
93
    ]
95
 
 
96
 
 
97
 
lpMapiRecipDesc = POINTER(MapiRecipDesc)
 
94
lpMapiRecipDesc  = POINTER(MapiRecipDesc)
98
95
lppMapiRecipDesc = POINTER(lpMapiRecipDesc)
99
96
 
100
 
 
101
97
class MapiFileDesc(Structure):
102
98
    _fields_ = [
103
 
        ('ulReserved', c_ulong),
104
 
        ('flFlags', c_ulong),
105
 
        ('nPosition', c_ulong),
106
 
        ('lpszPathName', c_char_p),
107
 
        ('lpszFileName', c_char_p),
108
 
        ('lpFileType', c_void_p),
 
99
        ('ulReserved',      c_ulong),
 
100
        ('flFlags',         c_ulong),
 
101
        ('nPosition',       c_ulong),
 
102
        ('lpszPathName',    c_char_p),
 
103
        ('lpszFileName',    c_char_p),
 
104
        ('lpFileType',      c_void_p),
109
105
    ]
110
 
 
111
 
 
112
106
lpMapiFileDesc = POINTER(MapiFileDesc)
113
107
 
114
 
 
115
108
class MapiMessage(Structure):
116
109
    _fields_ = [
117
 
        ('ulReserved', c_ulong),
118
 
        ('lpszSubject', c_char_p),
119
 
        ('lpszNoteText', c_char_p),
120
 
        ('lpszMessageType', c_char_p),
121
 
        ('lpszDateReceived', c_char_p),
122
 
        ('lpszConversationID', c_char_p),
123
 
        ('flFlags', FLAGS),
124
 
        ('lpOriginator', lpMapiRecipDesc),
125
 
        ('nRecipCount', c_ulong),
126
 
        ('lpRecips', lpMapiRecipDesc),
127
 
        ('nFileCount', c_ulong),
128
 
        ('lpFiles', lpMapiFileDesc),
 
110
        ('ulReserved',          c_ulong),
 
111
        ('lpszSubject',         c_char_p),
 
112
        ('lpszNoteText',        c_char_p),
 
113
        ('lpszMessageType',     c_char_p),
 
114
        ('lpszDateReceived',    c_char_p),
 
115
        ('lpszConversationID',  c_char_p),
 
116
        ('flFlags',             FLAGS),
 
117
        ('lpOriginator',        lpMapiRecipDesc),
 
118
        ('nRecipCount',         c_ulong),
 
119
        ('lpRecips',            lpMapiRecipDesc),
 
120
        ('nFileCount',          c_ulong),
 
121
        ('lpFiles',             lpMapiFileDesc),
129
122
    ]
130
 
 
131
 
 
132
123
lpMapiMessage = POINTER(MapiMessage)
133
124
 
134
 
MAPI = windll.mapi32
135
 
MAPISendMail = MAPI.MAPISendMail
136
 
MAPISendMail.restype = c_ulong
137
 
MAPISendMail.argtypes = (LHANDLE, c_ulong, lpMapiMessage, FLAGS, c_ulong)
 
125
MAPI                    = windll.mapi32
 
126
MAPISendMail            = MAPI.MAPISendMail
 
127
MAPISendMail.restype    = c_ulong
 
128
MAPISendMail.argtypes   = (LHANDLE, c_ulong, lpMapiMessage, FLAGS, c_ulong)
138
129
 
139
 
MAPIResolveName = MAPI.MAPIResolveName
 
130
MAPIResolveName         = MAPI.MAPIResolveName
140
131
MAPIResolveName.restype = c_ulong
141
 
MAPIResolveName.argtypes = (
142
 
    LHANDLE, c_ulong, c_char_p, FLAGS, c_ulong, lppMapiRecipDesc)
 
132
MAPIResolveName.argtypes= (LHANDLE, c_ulong, c_char_p, FLAGS, c_ulong, lppMapiRecipDesc)
143
133
 
144
 
MAPIFreeBuffer = MAPI.MAPIFreeBuffer
145
 
MAPIFreeBuffer.restype = c_ulong
 
134
MAPIFreeBuffer          = MAPI.MAPIFreeBuffer
 
135
MAPIFreeBuffer.restype  = c_ulong
146
136
MAPIFreeBuffer.argtypes = (c_void_p, )
147
137
 
148
 
MAPILogon = MAPI.MAPILogon
149
 
MAPILogon.restype = c_ulong
150
 
MAPILogon.argtypes = (LHANDLE, c_char_p, c_char_p, FLAGS, c_ulong, LPLHANDLE)
 
138
MAPILogon               = MAPI.MAPILogon
 
139
MAPILogon.restype       = c_ulong
 
140
MAPILogon.argtypes      = (LHANDLE, c_char_p, c_char_p, FLAGS, c_ulong, LPLHANDLE)
151
141
 
152
 
MAPILogoff = MAPI.MAPILogoff
153
 
MAPILogoff.restype = c_ulong
154
 
MAPILogoff.argtypes = (LHANDLE, c_ulong, FLAGS, c_ulong)
 
142
MAPILogoff              = MAPI.MAPILogoff
 
143
MAPILogoff.restype      = c_ulong
 
144
MAPILogoff.argtypes     = (LHANDLE, c_ulong, FLAGS, c_ulong)
155
145
 
156
146
 
157
147
class MAPIError(WindowsError):
265
255
    body = "Hi,\r\n\r\nthis is a quick test message,\r\n\r\ncheers,\r\nJohn."
266
256
    attachment = sys.argv[0]
267
257
    SendMail(recipient, subject, body, attachment)
 
258