Hello,
I updated this wiki page with more accurate information about 
the GData (I named it like that :D) format : 
http://www.amsn-project.net/wiki/index.php/Gmail
If someone is ready to take on the challenge of finding out how the timestamp 
is written, please do so, it 
would be nice to have that information ready for when I finish my exams... It's 
really easy, I just don't have 
much time for it right now...
Also, I'd like to know how you'd like me to implement the 'tell me' 
functionality of the plugin... should I show 
a popup window with that information (like the official google notifier), or 
should I rather show a window with 
a listbox of all new emails and the user clicks on the email to see more 
information...
I would go with the notify (more userfriendly) but I'm afraid I won't be able 
to give the full functionality to 
the users (like seeing who initiated a conversation, what the labels are, 
attachments, etc... ) easily...
I will also need to have a up/down buttons on the notify window so a user can 
view the mail info one by one.. 
Any suggestions ? someone wants to implement the notify winodw ? Tom perhaps? I 
know you love to play with 
canvas (and I have near zero knowledge of how canvas work...)

Thanks,
KaKaRoTo

----- Forwarded message from [EMAIL PROTECTED] -----

From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: [Amsn-commits] SF.net SVN: amsn: [7657]
        trunk/amsn-extras/plugins/gnotify

Revision: 7657
          http://svn.sourceforge.net/amsn/?rev=7657&view=rev
Author:   kakaroto
Date:     2006-12-13 22:39:46 -0800 (Wed, 13 Dec 2006)

Log Message:
-----------
Updated with some comments and taking into account the 'new' and 'initiator' 
keys of an unread mail author information.
Also fixed the timestamp parsing which is two separate keys with values instead 
of a single 16 bytes header.
http://www.amsn-project.net/wiki/index.php/Gmail

Modified Paths:
--------------
    trunk/amsn-extras/plugins/gnotify/gnotify.tcl

Property Changed:
----------------
    trunk/amsn-extras/plugins/gnotify/


Property changes on: trunk/amsn-extras/plugins/gnotify
___________________________________________________________________
Name: svn:ignore
   + *


Modified: trunk/amsn-extras/plugins/gnotify/gnotify.tcl
===================================================================
--- trunk/amsn-extras/plugins/gnotify/gnotify.tcl       2006-12-13 21:17:15 UTC 
(rev 7656)
+++ trunk/amsn-extras/plugins/gnotify/gnotify.tcl       2006-12-14 06:39:46 UTC 
(rev 7657)
@@ -7,6 +7,8 @@
 ###################################################################
 
 
+# For more information on the format and protocol read this article :
+# http://www.amsn-project.net/wiki/index.php/Gmail
 namespace eval ::gnotify {
        variable config
        variable configlist
@@ -404,13 +406,14 @@
                                                puts "$att "
                                        }
                                }
-                       #       if {[llength $mail(tags)] > 0 } {
-                       #               puts -nonewline "tags : "
-                       #               foreach tag $mail(tags) {
-                       #                       puts -nonewline "$tag, "
-                       #               }
-                       #       }
+                               if {[llength $mail(tags)] > 0 } {
+                                       puts -nonewline "tags : "
+                                       foreach tag $mail(tags) {
+                                               puts -nonewline "$tag, "
+                                       }
+                               }
                                puts ""
+                               #puts "Timestamp : $mail(timestamp)"
                        }
                }
        }
@@ -634,28 +637,37 @@
 
                set start $data(offset)
                set end [expr {$start + $size}]
-               set info(author) [list email "" nick ""]
+               set info(author) [list errors 0 email "" nick ""]
+               set info(new) 0
+               set info(initiator) 0
                set info(errors) 0
 
                while {$data(offset) < $end } {
                        set key [ReadKey data]
                        switch -- $key {
                                10 {
+                                       # 0x0A Author info
                                        set size [ReadSize data]
                                        set offset $data(offset)
                                        set info(author) [GetMailAuthor2 data 
$size]
                                        set data(offset) [expr {$offset + 
$size}]       
                                }
-                               16 {
-                                       # unknown
-                                       GetMultiByte $var
+                               16 {    
+                                       # 0x10 Has unread mail
+                                       # This key specifies whether an email 
of this author in the thread is unread
+                                       if { [GetMultiByte $var] == 1} {
+                                               set info(new) 1
+                                       } 
                                }
                                24 {
-                                       # unknown
-                                       GetMultiByte $var
+                                       # 0x18 Thread Initiator
+                                       # This key specifies whether this user 
is the one who started the thread
+                                       if { [GetMultiByte $var] == 1} {
+                                               set info(initiator) 1
+                                       } 
                                } 
                                default {
-                                       puts "Unknown author key : $key"
+                                       puts "Unknown author ($info(author)) 
key : $key"
                                        incr info(errors)
                                }
                        }
@@ -678,11 +690,13 @@
                        set key [ReadKey data]
                        switch -- $key {
                                10 {
+                                       # 0x0A Email
                                        set size [ReadSize data]
                                        set email [DecodeString [GetBytes data 
$size]]
                                        set info(email) $email
                                }
                                18 {
+                                       # 0x12 Name
                                        set size [ReadSize data]
                                        set nick [DecodeString [GetBytes data 
$size]]
                                        set info(nick) $nick
@@ -702,9 +716,9 @@
 
                set start $data(offset)
                set end [expr {$start + $size}]
-               set timestamp_size [GetMultiByte $var]
 
-               set info(timestamp) [GetBytes data $timestamp_size]
+               set info(timestamp) ""
+               set info(timestamp2) ""
                set info(attachments) [list]
                set info(tags) [list]
                set info(authors) [list]
@@ -713,41 +727,59 @@
                set info(threads) 1
                set info(errors) 0
 
+
+
                while {$data(offset) < $end } {
                        set key [ReadKey data]
                        switch -- $key {
+                               16 {
+                                       # 0x10 unknown / timestamp
+                                       #puts "Unknown mail key 16 has value : 
[GetMultiByte $var]"
+                                       set info(timestamp)  [GetMultiByte $var]
+                               } 
+                               24 {
+                                       # 0x18 unknown / timestamp
+                                       #puts "Unknown mail key 24 has value : 
[GetMultiByte $var]"
+                                       set info(timestamp2)  [GetMultiByte 
$var]
+                               }
                                130 {
+                                       # 0x82 Tag
                                        set size [ReadSize data]
                                        set tag [GetBytes data $size]
                                        lappend info(tags) $tag
                                }
                                146 {
-                                       # from
+                                       # 0x92 from
                                        set size [ReadSize data]
                                        set offset $data(offset)
                                        lappend info(authors) [GetMailAuthor 
data $size]
                                        set data(offset) [expr {$offset + 
$size}]
                                }
                                152 {
-                                       # unknown
+                                       # 0x98 unknown
+                                       #puts "Unknown mail key 152 has value : 
[GetMultiByte $var]"
                                        GetMultiByte $var
                                }
                                162 {
+                                       # 0xA2 Subject
                                        set size [ReadSize data]
                                        set subject [DecodeString [GetBytes 
data $size]]
                                        set info(subject) $subject
                                }
                                170 {
+                                       # 0xAA Body preview
                                        set size [ReadSize data]
                                        set body [DecodeString [GetBytes data 
$size]]
                                        set info(body) $body
                                }
                                178 {
+                                       # 0xB2 Attachment
                                        set size [ReadSize data]
                                        set attachment [DecodeString [GetBytes 
data $size]]
                                        lappend info(attachments) $attachment
                                }
                                184 {
+                                       # 0xB8 Number of threads
                                        set info(threads) [GetMultiByte data]
                                }
                                default {
@@ -760,6 +792,8 @@
 
        }
 
+       # For more information on the format and protocol read this article :
+       # http://www.amsn-project.net/wiki/index.php/Gmail
        proc parseGData { data_bin } {
                set data(bin) $data_bin
                set data(len) [string length $data_bin]
@@ -774,12 +808,14 @@
                        set key [ReadKey data]
                        switch -- $key {
                                10 {
+                                       # 0x0A New mail Key
                                        set size [ReadSize data]
                                        set offset $data(offset)
                                        lappend info(mails) [GetNewMail data 
$size]
                                        set data(offset) [expr {$offset + 
$size}]
                                }
                                136 {
+                                       # 0x88 Number of mails Key
                                        set info(nb_mails) [GetMultiByte data]
                                }
                                default {


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Amsn-commits mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/amsn-commits

----- End forwarded message -----

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Amsn-devel mailing list
Amsn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amsn-devel

Reply via email to