Commits

Philip Pryce committed 6e76578

Fixing long standing topic bug, introduced when parsed

  • Participants
  • Parent commits a63dae3

Comments (0)

Files changed (2)

File javascript/jolt.js

 	 **/
 	function parse_incoming_msg (msg)
 	{
-		var msg = new String(msg);
+		// This is a very... very odd Javascript bug...
+		msg = msg.toString();
 		
 		// URLs
 		if (msg.indexOf('http') > -1)
 			msg = msg.replace(channel_regex, '<span class="channel-name" title="Join: \$1">\$1</span>');
 		}
 		
-		return msg;
+		// Again, the oddness of Javascript shall never be explained
+		return msg.toString();
 	}
 	
 	/**
 		    msg = msg.replace(new RegExp(exp, "g"), "{emote\t\t" + escape(code) + "\t" + src + "\t\t}");
 		}
 		
-		return msg;
+		return msg.toString();
 	}
 	
 	function deep_parse (deep_string, part_parse, delimeter1, delimeter2)
 			// Topic change property packet
 			//  This means someone has changed the topic and
 			//  therefore the UI needs to be updated.
-			var topic = this.parameters.t;
+			var topic = Jolt.parse_incoming_msg(this.parameters.t);
 			
 			// Update the topic UI
 			UI.channel.set_topic(channel, topic);
+			if (UI.sidebar.current_type() == 'channel' && UI.sidebar.current_name() == channel)
+			{
+				$('.topic .wrap').html(topic);
+			}
 		}
 		if (this.subcommand == 'privclass')
 		{

File javascript/ui.js

 			
 			UI.sidebar.set_current('channel', name);
 			
-			UI.channel.set_topic(name);
+			var topic = UI.channel.get_topic(name);
+			if (topic !== null) { $('.topic .wrap').html(topic); }
 			
 			UI.sidebar.events();
 			UI.composer.enable();
 		clear: function (channel) { $('#view-channel-' + channel).empty(); },
 		
 		/**
-		 * Set the topic of a channel.
+		 * Topic of a channel.
 		 **/
 		set_topic: function (channel, topic)
 		{
-			topic = topic || false;
-			if (topic !== false) { UI.datastore.topics[channel] = topic; }
-			else { topic = UI.datastore.topics[channel]; }
-			
-			if (UI.sidebar.current_type() == 'channel' && UI.sidebar.current_name() == channel)
-			{
-				topic = Jolt.parse_incoming_msg(topic);
-				$('.wrap', '.topic').html(topic);
-			}
-			
-			UI.onresize();
+			if (!!topic) { UI.datastore.topics[channel] = topic.toString(); }
+			return false;
+		},
+		get_topic: function (channel)
+		{
+			if (!!UI.datastore.topics[channel]) { return UI.datastore.topics[channel].toString(); }
+			return null;
 		},
 		
 		/**