41
40
void OnUpdated (object sender, EventArgs args)
43
Console.WriteLine ("Got Presence Updated!");
42
Logger.Log ("Got Presence Updated!");
44
43
if (PresenceChanged != null)
45
44
PresenceChanged (this, args);
48
void OnPersonAdded (object sender, Galago.AddedArgs args)
47
void OnPersonAdded (object sender, Galago.PersonAddedArgs args)
50
Console.WriteLine ("Person Added!");
49
Logger.Log ("Person Added!");
52
51
UpdateTrie (false);
53
52
if (PeopleChanged != null)
54
53
PeopleChanged (this, args);
57
void OnPersonRemoved (object sender, Galago.RemovedArgs args)
56
void OnPersonRemoved (object sender, Galago.PersonRemovedArgs args)
59
Console.WriteLine ("Person Removed!");
58
Logger.Log ("Person Removed!");
61
60
UpdateTrie (false);
62
61
if (PeopleChanged != null)
68
67
trie = new TrieTree (false /* !case_sensitive */);
69
68
ArrayList people = new ArrayList ();
71
Console.WriteLine ("Loading up the person trie, Part 1...");
73
foreach (Person person in Galago.Core.GetPeople (false, refresh_query)) {
74
string fname, mname, lname;
75
person.GetProperty ("first-name", out fname);
76
person.GetProperty ("middle-name", out mname);
77
person.GetProperty ("last-name", out lname);
79
if (person.DisplayName != null) {
70
Logger.Log ("Loading up the person trie, Part 1...");
72
foreach (Person person in Galago.Global.GetPeople (Galago.Origin.Remote,
74
string name = person.DisplayName;
80
77
people.Add (new PersonLink (LinkType.PersonDisplayName, person));
85
people.Add (new PersonLink (LinkType.FirstName, person));
88
// Joe Smith & Smith Joe
89
if (fname != null && lname != null) {
90
people.Add (new PersonLink (LinkType.FirstLastName, person));
91
people.Add (new PersonLink (LinkType.LastFirstName, person));
95
if (fname != null && mname != null && lname != null) {
96
people.Add (new PersonLink (LinkType.FirstMiddleLastName, person));
99
80
foreach (Account account in person.GetAccounts(true)) {
100
81
if (account.DisplayName != null) {
101
82
people.Add (new PersonLink (LinkType.AccountDisplayName,
105
if (account.UserName != null &&
106
account.UserName != account.DisplayName) {
86
if (account.Username != null &&
87
account.Username != account.DisplayName) {
107
88
people.Add (new PersonLink (LinkType.AccountUserName,
113
Console.WriteLine ("Loading up the person trie, Part 2...");
94
Logger.Log ("Loading up the person trie, Part 2...");
115
96
foreach (PersonLink plink in people) {
116
97
trie.AddKeyword (plink.LinkText, plink);
119
Console.WriteLine ("Done.");
100
Logger.Log ("Done.");
143
120
this.person = person;
144
121
this.account = null;
146
Console.WriteLine ("Added person {0}: {1}", link_type, LinkText);
123
Logger.Log ("Added person {0}: {1}", link_type, LinkText);
149
126
public PersonLink (LinkType type, Account account)
152
129
this.person = account.Person;
153
130
this.account = account;
155
Console.WriteLine ("Added account {0}: {1}", link_type, LinkText);
132
Logger.Log ("Added account {0}: {1}", link_type, LinkText);
158
135
public string LinkText
161
string fname, mname, lname;
162
person.GetProperty ("first-name", out fname);
163
person.GetProperty ("middle-name", out mname);
164
person.GetProperty ("last-name", out lname);
166
139
switch (link_type) {
167
140
case LinkType.PersonDisplayName:
168
141
return person.DisplayName;
169
142
case LinkType.AccountUserName:
170
return account.UserName;
143
return account.Username;
171
144
case LinkType.AccountDisplayName:
172
145
return account.DisplayName;
173
case LinkType.FirstName:
175
case LinkType.FirstLastName:
176
return fname + " " + lname;
177
case LinkType.LastFirstName:
178
return lname + " " + fname;
179
case LinkType.FirstMiddleLastName:
180
return fname + " " + mname + " " + lname;
191
156
if (person != null) {
192
// BINDING BUG: Returns a Person instead of Account
193
Person foo = person.PriorityAccount;
194
Account best = new Account (foo.Handle);
157
Account best = person.PriorityAccount;
196
Console.WriteLine ("Using priority account '{0}' for {1}",
159
Logger.Log ("Using priority account '{0}' for {1}",
275
238
string message = Catalog.GetString ("Error running gaim-remote: {0}");
276
239
message = String.Format (message, e.Message);
278
Console.WriteLine (message);
241
Logger.Log (message);
280
243
HIGMessageDialog dialog =
281
244
new HIGMessageDialog (editor.Toplevel as Gtk.Window,
315
278
if (person_tag == null) {
316
279
person_tag = new PersonTag ("link:person", galago);
318
Console.WriteLine ("Adding link:person tag...");
281
Logger.Log ("Adding link:person tag...");
319
282
Note.TagTable.Add (person_tag);
369
332
Gtk.TextIter match_end = match_start;
370
333
match_end.ForwardChars (hit.End - hit.Start);
372
Console.WriteLine ("Matching Person '{0}' at {1}-{2}...",
335
Logger.Log ("Matching Person '{0}' at {1}-{2}...",
376
339
Buffer.ApplyTag (person_tag, match_start, match_end);