27 MODERATOR |
27 MODERATOR |
28 } |
28 } |
29 |
29 |
30 static Role role_from_string(string role) { |
30 static Role role_from_string(string role) { |
31 switch (role) { |
31 switch (role) { |
32 case "moderator": return Role.MODERATOR; break; |
32 case "moderator": return Role.MODERATOR; |
33 case "participant": return Role.PARTICIPANT; break; |
33 case "participant": return Role.PARTICIPANT; |
34 case "visitor": return Role.VISITOR; break; |
34 case "visitor": return Role.VISITOR; |
35 } |
35 } |
36 return Role.NONE; |
36 return Role.NONE; |
37 } |
37 } |
38 static Affiliation affil_from_string(string affil) { |
38 static Affiliation affil_from_string(string affil) { |
39 switch (affil) { |
39 switch (affil) { |
40 case "owner": return Affiliation.OWNER; break; |
40 case "owner": return Affiliation.OWNER; |
41 case "admin": return Affiliation.ADMIN; break; |
41 case "admin": return Affiliation.ADMIN; |
42 case "member": return Affiliation.MEMBER; break; |
42 case "member": return Affiliation.MEMBER; |
43 case "outcast": return Affiliation.OUTCAST; break; |
43 case "outcast": return Affiliation.OUTCAST; |
44 } |
44 } |
45 return Affiliation.NONE; |
45 return Affiliation.NONE; |
46 } |
46 } |
47 |
47 |
48 public class Occupant : Object { |
48 public class Occupant : Object { |
66 public signal void on_join(Conference conf, Occupant occupant); |
66 public signal void on_join(Conference conf, Occupant occupant); |
67 public signal void on_part(Conference conf, Occupant occupant); |
67 public signal void on_part(Conference conf, Occupant occupant); |
68 public signal void on_role(Conference conf, Occupant occupant, Role prev); |
68 public signal void on_role(Conference conf, Occupant occupant, Role prev); |
69 public signal void on_affil(Conference conf, Occupant occupant, Affiliation prev); |
69 public signal void on_affil(Conference conf, Occupant occupant, Affiliation prev); |
70 public signal void on_nick(Conference conf, Occupant occupant, string prev); |
70 public signal void on_nick(Conference conf, Occupant occupant, string prev); |
71 public signal void on_message(Conference conf, Occupant occupant, Lm.MessageNode message, string body); |
71 public signal void on_message(Conference conf, Occupant? occupant, Lm.MessageNode message, string? body); |
72 public signal void on_subject(Conference conf); |
72 public signal void on_subject(Conference conf, Occupant? occupant); |
73 |
73 |
74 public class Conference : Object { |
74 public class Conference : Object { |
75 public string jid; |
75 public string jid; |
76 public string nick; |
76 public string nick; |
77 public string desired_nick; |
77 public string desired_nick; |
225 } |
225 } |
226 break; |
226 break; |
227 } |
227 } |
228 } else if ((message.get_type()==Lm.MessageType.MESSAGE)&&(type=="groupchat")) { |
228 } else if ((message.get_type()==Lm.MessageType.MESSAGE)&&(type=="groupchat")) { |
229 var subj = node.get_attribute("subject"); |
229 var subj = node.get_attribute("subject"); |
|
230 var occupant = (from.length > 1) ? occupants[from[1]] : null; |
230 if (subj != null) { |
231 if (subj != null) { |
231 if (subj != this.subject) { |
232 if (subj != this.subject) { |
232 this.subject = subj; |
233 this.subject = subj; |
233 module.on_subject(this); |
234 module.on_subject(this, occupant); |
234 } |
235 } |
235 } else { |
236 } else { |
236 var occupant = (from.length > 1) ? occupants[from[1]] : null; |
|
237 var body = node.find_child("body"); |
237 var body = node.find_child("body"); |
238 module.on_message(this, occupant, node, (body!=null) ? body.get_value() : null); |
238 module.on_message(this, occupant, node, (body!=null) ? body.get_value() : null); |
239 } |
239 } |
240 } |
240 } |
241 return Lm.HandlerResult.ALLOW_MORE_HANDLERS; |
241 return Lm.HandlerResult.ALLOW_MORE_HANDLERS; |