'use strict';

module.exports = function (client) {

	function enabled(msg) {
		return msg.markable && client.config.chatMarkers !== false;
	}

	client.disco.addFeature('urn:xmpp:chat-markers:0');

	client.on('message', function(msg) {
		if (enabled(msg)) {
			client.sendMessage({
				to: msg.from,
				received: msg.id
			});
			return ;
		}

		if (msg.received) {
			return client.emit('marker:received', msg.received);
		}

		if (msg.displayed) {
			return client.emit('marker:displayed', msg.displayed);
		}

		if (msg.acknowledged) {
			return client.emit('marker:acknowledged', msg.acknowledged);
		}
	});
	
	client.markDisplayed = function(msg) {
		if (enabled(msg)) {
			client.sendMessage({
				to: msg.from,
				displayed: msg.id
			});
		}
	};

	client.markAcknowledged = function(msg) {
		if (enabled(msg)) {
			client.sendMessage({
				to: msg.from,
				acknowledged: msg.id
			});
		}
	};
};

@@ -46,17 +46,20 @@
 ent) %7B%0A%0A
-%09
+    
 function
@@ -74,18 +74,24 @@
 (msg) %7B%0A
-%09%09
+        
 return m
@@ -142,21 +142,27 @@
  false;%0A
-%09%7D%0A%0A%09
+    %7D%0A%0A    
 client.d
@@ -206,17 +206,20 @@
 s:0');%0A%0A
-%09
+    
 client.o
@@ -239,34 +239,40 @@
 function(msg) %7B%0A
-%09%09
+        
 if (enabled(msg)
@@ -267,35 +267,44 @@
 enabled(msg)) %7B%0A
-%09%09%09
+            
 client.sendMessa
@@ -312,73 +312,127 @@
 e(%7B%0A
-%09%09%09%09to: msg.from,%0A%09%09%09%09received: msg.id%0A%09%09%09%7D);%0A%09%09%09return ;%0A%09%09%7D%0A%0A%09%09
+                to: msg.from,%0A                received: msg.id%0A            %7D);%0A            return ;%0A        %7D%0A%0A        
 if (
@@ -443,27 +443,36 @@
 received) %7B%0A
-%09%09%09
+            
 return clien
@@ -508,31 +508,43 @@
 .received);%0A
-%09%09%7D%0A%0A%09%09
+        %7D%0A%0A        
 if (msg.disp
@@ -548,27 +548,36 @@
 isplayed) %7B%0A
-%09%09%09
+            
 return clien
@@ -623,15 +623,27 @@
 d);%0A
-%09%09%7D%0A%0A%09%09
+        %7D%0A%0A        
 if (
@@ -662,19 +662,28 @@
 dged) %7B%0A
-%09%09%09
+            
 return c
@@ -739,20 +739,35 @@
 d);%0A
-%09%09%7D%0A%09%7D);%0A%09%0A%09
+        %7D%0A    %7D);%0A    %0A    
 clie
@@ -793,34 +793,40 @@
 function(msg) %7B%0A
-%09%09
+        
 if (enabled(msg)
@@ -821,35 +821,44 @@
 enabled(msg)) %7B%0A
-%09%09%09
+            
 client.sendMessa
@@ -866,65 +866,110 @@
 e(%7B%0A
-%09%09%09%09to: msg.from,%0A%09%09%09%09displayed: msg.id%0A%09%09%09%7D);%0A%09%09%7D%0A%09%7D;%0A%0A%09
+                to: msg.from,%0A                displayed: msg.id%0A            %7D);%0A        %7D%0A    %7D;%0A%0A    
 clie
@@ -1006,18 +1006,24 @@
 (msg) %7B%0A
-%09%09
+        
 if (enab
@@ -1034,19 +1034,28 @@
 msg)) %7B%0A
-%09%09%09
+            
 client.s
@@ -1071,63 +1071,105 @@
 e(%7B%0A
-%09%09%09%09to: msg.from,%0A%09%09%09%09acknowledged: msg.id%0A%09%09%09%7D);%0A%09%09%7D%0A%09
+                to: msg.from,%0A                acknowledged: msg.id%0A            %7D);%0A        %7D%0A    
 %7D;%0A%7D

Use spaces