muc.vala
changeset 3 dd7a02c6d476
parent 2 4e050075fab9
child 9 d3260253f0bd
--- a/muc.vala	Tue Oct 23 18:33:49 2012 +0400
+++ b/muc.vala	Tue Oct 23 23:50:28 2012 +0400
@@ -29,18 +29,18 @@
 
     static Role role_from_string(string role) {
         switch (role) {
-            case "moderator": return Role.MODERATOR; break;
-            case "participant": return Role.PARTICIPANT; break;
-            case "visitor": return Role.VISITOR; break;
+            case "moderator": return Role.MODERATOR;
+            case "participant": return Role.PARTICIPANT;
+            case "visitor": return Role.VISITOR;
         }
         return Role.NONE;
     }
     static Affiliation affil_from_string(string affil) {
         switch (affil) {
-            case "owner": return Affiliation.OWNER; break;
-            case "admin": return Affiliation.ADMIN; break;
-            case "member": return Affiliation.MEMBER; break;
-            case "outcast": return Affiliation.OUTCAST; break;
+            case "owner": return Affiliation.OWNER;
+            case "admin": return Affiliation.ADMIN;
+            case "member": return Affiliation.MEMBER;
+            case "outcast": return Affiliation.OUTCAST;
         }
         return Affiliation.NONE;
     }
@@ -68,8 +68,8 @@
     public signal void on_role(Conference conf, Occupant occupant, Role prev);
     public signal void on_affil(Conference conf, Occupant occupant, Affiliation prev);
     public signal void on_nick(Conference conf, Occupant occupant, string prev);
-    public signal void on_message(Conference conf, Occupant occupant, Lm.MessageNode message, string body);
-    public signal void on_subject(Conference conf);
+    public signal void on_message(Conference conf, Occupant? occupant, Lm.MessageNode message, string? body);
+    public signal void on_subject(Conference conf, Occupant? occupant);
 
     public class Conference : Object {
         public string jid;
@@ -227,13 +227,13 @@
                 }
             } else if ((message.get_type()==Lm.MessageType.MESSAGE)&&(type=="groupchat")) {
                 var subj = node.get_attribute("subject");
+                var occupant = (from.length > 1) ? occupants[from[1]] : null;
                 if (subj != null) {
                     if (subj != this.subject) {
                         this.subject = subj;
-                        module.on_subject(this);
+                        module.on_subject(this, occupant);
                     }
                 } else {
-                    var occupant = (from.length > 1) ? occupants[from[1]] : null;
                     var body = node.find_child("body");
                     module.on_message(this, occupant, node, (body!=null) ? body.get_value() : null);
                 }