Hacking Gmail

(Grace) #1

88 Part II — Getting Inside Gmail


this quite clearly in the example above. The lines in bold type show the headers
for all three messages, and the whole thing finishes with the entire content of the
requested message.

You then allow the JavaScript code to wrangle the interface afterward. This is a
clever trick: it allows the interface to be very quick at the point the user wants it to
be — when you’re reading through a thread — instead of loading each message
individually.

So, you now know how to retrieve messages. But how do you read them?

Listing 5-14 shows the relevant bit of JavaScript.

Listing 5-14: The Message Itself

D([“mi”,0,3,”10187696869432e6”,0,”0”,”Ben
Hammersley”,”[email protected]”,”me”,”8:59pm (12 minutes
ago)”,[“Ben Hammersley <[email protected]>”]
,[]
,[]
,[]
,”Tue, 18 Jan 2005 20:59:40 +0100”,”Re: This is the third
message”,””,[]
,1,,,”Tue Jan 18 2005_11:59AM”]
);
D([“mb”,”And this is another reply back yet again<br>”,1]
);
D([“mb”,”<div><div class=ea><span id=e_10187696869432e6_1>-
Show quoted text -</span></div><span class=e
id=q_10187696869432e6_1><br>On 18 Jan 2005, at 20:59, Ben
Hammersley wrote:<br><br>> And this is a reply
back<br>><br>><br>> On Tue, 18 Jan 2005 16:05:17
+0100, Ben Hammersley<br>> <<a onclick=\”return
top.js.OpenExtLink(window,event,this)\”
href=\”mailto:[email protected]\”>[email protected]</a
>> wrote:<br>>> 3rd! THREE!
THIRD!<br>>><br>>><br><br></span></div>”,0]
);

From this you can see that the message is sent in three JavaScript arrays.D([“mi”
contains the header information — its status, the message ID, who sent it, and so
on — and then there are two arrays starting with D([“mb”that contain the first
Free download pdf