~igors/do-plugins/Thunderbird-fix-redux

« back to all changes in this revision

Viewing changes to Thunderbird/src/ThunderbirdContactItemSource.cs

  • Committer: Igor Slepchin
  • Date: 2010-01-10 17:50:57 UTC
  • mto: This revision was merged to the branch mainline in revision 720.
  • Revision ID: igor.gnomedo@gmail.com-20100110175057-018keeczdwvms7kw
Get rid of a data member that is only needed to compute UpdateItems.

Show diffs side-by-side

added added

removed removed

Lines of Context:
128
128
                const string THUNDERBIRD_EMAIL   = "email.thunderbird";
129
129
 
130
130
                Dictionary<string, Item> contacts; // name => ContactItem
131
 
                Dictionary<string, EmailList> emails; // name => list of emails
132
131
                
133
132
                public ThunderbirdContactItemSource ()
134
133
                {
135
134
                        contacts = new Dictionary<string, Item> ();
136
 
                        emails   = new Dictionary<string, EmailList> ();
137
135
                }
138
136
                
139
137
                public override IEnumerable<Type> SupportedItemTypes {
141
139
                                return new Type[] {
142
140
                                        typeof (ContactItem),
143
141
                                };
144
 
                        }
 
142
            }
145
143
                }
146
144
                
147
145
                public override string Name { get { return "Thunderbird Contacts"; } }
179
177
                void _UpdateItems ()
180
178
                {
181
179
                        MorkDatabase abook, history;
 
180
                        Dictionary<string, EmailList> emails = new Dictionary<string, EmailList> ();
182
181
 
183
182
                        abook = new MorkDatabase (GetThunderbirdAddressBookFilePath ());
184
183
                        abook.Read ();
188
187
                        history.Read ();
189
188
                        history.EnumNamespace = "ns:addrbk:db:row:scope:card:all";
190
189
 
 
190
                        addEmails (emails, history);
 
191
                        addEmails (emails, abook);
 
192
 
191
193
                        contacts.Clear ();
192
 
                        emails.Clear ();
193
 
 
194
 
                        addEmails (history);
195
 
                        addEmails (abook);
196
 
 
197
194
                        foreach (string name in emails.Keys)
198
195
                        {
199
196
                                CreateThunderbirdContactItem (name, emails[name]);
200
197
                        }
201
198
                }
202
199
 
203
 
                void addEmails (MorkDatabase database)
 
200
                void addEmails (Dictionary<string, EmailList> emails, MorkDatabase database)
204
201
                {
205
202
                        foreach (string id in database)
206
203
                        {
207
204
                                Hashtable contact_row = database.Compile (id, database.EnumNamespace);
208
 
                                AddThunderbirdEmail (contact_row);
 
205
                                AddThunderbirdEmail (emails, contact_row);
209
206
                        }
210
207
                }
211
208
        
212
 
                void AddThunderbirdEmail (Hashtable row)
 
209
                void AddThunderbirdEmail (Dictionary<string, EmailList> emails, Hashtable row)
213
210
                {
214
211
                        string name, email;
215
212
                        uint popularity;