]> jfr.im git - irc/quakenet/qwebirc.git/commitdiff
Work on issue #50, topic editing now works but since we don't track channel modes...
authorChris Porter <redacted>
Sun, 21 Jun 2009 17:06:56 +0000 (18:06 +0100)
committerChris Porter <redacted>
Sun, 21 Jun 2009 17:06:56 +0000 (18:06 +0100)
js/ui/frontends/qui.js

index 6de600dbba2ba01f0f13f02491e79690a3a3b284..cb083ce04298756aa97669bce8fb53b5ab880959 100644 (file)
@@ -385,6 +385,7 @@ qwebirc.ui.QUI.Window = new Class({
       this.topic.addClass("topic");
       this.topic.addClass("tab-invisible");
       this.topic.set("html", "&nbsp;");
+      this.topic.addEvent("click", this.editTopic.bind(this));
       this.parentObject.qjsui.applyClasses("topic", this.topic);
       
       this.prevNick = null;
@@ -401,6 +402,20 @@ qwebirc.ui.QUI.Window = new Class({
       this.reflow();
     }
   },
+  editTopic: function() {
+    if(!this.client.nickOnChanHasPrefix(this.client.nickname, this.name, "@")) {
+/*      var cmodes = this.client.getChannelModes(channel);
+      if(cmodes.indexOf("t")) {*/
+        alert("Sorry, you need to be opped to change the topic!");
+        return;
+      /*}*/
+    }
+    var newTopic = prompt("Change topic of " + this.name + " to:", this.topic.topicText);
+    if(newTopic === null)
+      return;
+
+    this.client.exec("/TOPIC " + newTopic);
+  },
   reflow: function() {
     this.parentObject.reflow();
   },
@@ -505,8 +520,10 @@ qwebirc.ui.QUI.Window = new Class({
       t.removeChild(t.firstChild);
 
     if(topic) {
+      t.topicText = topic;
       this.parent(topic, t);
     } else {
+      t.topicText = topic;
       var e = new Element("div");
       e.set("text", "(no topic set)");
       e.addClass("emptytopic");