wimap

Check-in [b797c891d4]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Start reading a folder at *newest*, not oldest
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | master | trunk
Files: files | file ages | folders
SHA3-256:b797c891d44069d9e18923439f42725ff279e3f77466bd9f434e56c7595fade6
User & Date: ajv-899-334-8894@vsta.org 2016-12-04 15:54:18
Context
2017-03-16
13:13
LG service doesn't put a Date header in their auto-messages, huh check-in: 8262cb957b user: ajv-899-334-8894@vsta.org tags: master, trunk
2016-12-04
15:54
Start reading a folder at *newest*, not oldest check-in: b797c891d4 user: ajv-899-334-8894@vsta.org tags: master, trunk
2016-11-30
22:50
Wrestle with some horrible edge cases from eBay check-in: b9f983566b user: ajv-899-334-8894@vsta.org tags: master, trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to get.py.

133
134
135
136
137
138
139
140
141
142
143
144
145
146
147





148
149
150
151
152
153
154
155
156
157

158
159
160
161
162
163
164
        # Start at which index number?
        if self.vals and ("from" in self.vals):
            try:
                startidx = int(self.vals["from"])
            except:
                return False,None
        else:
            startidx = 1

        # Ask our library to pull them together
        srv = self.get_server()
        tup = srv.messages(fn, startidx, NMSG)
        if tup is None:
            return False,None
        nmsg,msgs = tup






        # Here's your messages
        ourpath = '/'.join(self.paths)
        buf = self.build_header("Messages %d-%d" %
            (startidx, startidx+len(msgs)-1))
        buf += '<table border="1" frame="void" rules="rows">\n'
        for msgidx,flags,fields in msgs:
            buf += ' <tr>\n'

            # Date/time

            when = self.get_when(fields)

            # Emphasize time for unread
            if "Seen" not in flags:
                tms = "<em>%s</em>" % (when,)

            # Add date







|







>
>
>
>
>







<


>







133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159

160
161
162
163
164
165
166
167
168
169
        # Start at which index number?
        if self.vals and ("from" in self.vals):
            try:
                startidx = int(self.vals["from"])
            except:
                return False,None
        else:
            startidx = None

        # Ask our library to pull them together
        srv = self.get_server()
        tup = srv.messages(fn, startidx, NMSG)
        if tup is None:
            return False,None
        nmsg,msgs = tup

	# Note actual starting index if they didn't specify
	#  one and we're going with the newest
	if startidx is None:
	    startidx = msgs[0][0]

        # Here's your messages
        ourpath = '/'.join(self.paths)
        buf = self.build_header("Messages %d-%d" %
            (startidx, startidx+len(msgs)-1))
        buf += '<table border="1" frame="void" rules="rows">\n'
        for msgidx,flags,fields in msgs:


            # Date/time
            buf += ' <tr>\n'
            when = self.get_when(fields)

            # Emphasize time for unread
            if "Seen" not in flags:
                tms = "<em>%s</em>" % (when,)

            # Add date

Changes to imap.py.

275
276
277
278
279
280
281







282
283
284
285
286
287
288
        srv = self.srv

        # Select folder, get message count
        tup = srv.select(fn, readonly=True)
        if tup[0] != "OK":
            return None
        nmsg = int(tup[1][0])








        # Walk messages, generating metadata for each message
        res = []
        msgcount = 0
        while msgidx <= nmsg:
            # Message header
            tup = srv.fetch(msgidx,







>
>
>
>
>
>
>







275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
        srv = self.srv

        # Select folder, get message count
        tup = srv.select(fn, readonly=True)
        if tup[0] != "OK":
            return None
        nmsg = int(tup[1][0])

	# If didn't specify an index, start from newest
	if msgidx is None:
	    if maxmsg >= nmsg:
		msgidx = 1
	    else:
		msgidx = (nmsg - maxmsg)+1

        # Walk messages, generating metadata for each message
        res = []
        msgcount = 0
        while msgidx <= nmsg:
            # Message header
            tup = srv.fetch(msgidx,