Skip to content

Commit 5f75fc5

Browse files
authored
Merge pull request #220 from 790/eventtags
Add message tags to more events
2 parents 88634b8 + b19e881 commit 5f75fc5

File tree

6 files changed

+90
-42
lines changed

6 files changed

+90
-42
lines changed

src/commands/handlers/channel.js

Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ var handlers = {
1616
channel: channel,
1717
modes: modes,
1818
raw_modes: raw_modes,
19-
raw_params: raw_params
19+
raw_params: raw_params,
20+
tags: command.tags
2021
});
2122
},
2223

@@ -26,7 +27,8 @@ var handlers = {
2627

2728
handler.emit('channel info', {
2829
channel: channel,
29-
created_at: parseInt(command.params[2], 10)
30+
created_at: parseInt(command.params[2], 10),
31+
tags: command.tags
3032
});
3133
},
3234

@@ -36,7 +38,8 @@ var handlers = {
3638

3739
handler.emit('channel info', {
3840
channel: channel,
39-
url: command.params[command.params.length - 1]
41+
url: command.params[command.params.length - 1],
42+
tags: command.tags
4043
});
4144
},
4245

@@ -74,7 +77,8 @@ var handlers = {
7477
nick: user.nick,
7578
ident: user.user,
7679
hostname: user.host,
77-
modes: modes
80+
modes: modes,
81+
tags: command.tags
7882
});
7983
});
8084
},
@@ -100,7 +104,8 @@ var handlers = {
100104
channel: command.params[1],
101105
invited: command.params[2],
102106
invited_by: command.params[3],
103-
invited_at: command.params[4]
107+
invited_at: command.params[4],
108+
tags: command.tags
104109
});
105110
},
106111

@@ -126,7 +131,8 @@ var handlers = {
126131
channel: command.params[1],
127132
banned: command.params[2],
128133
banned_by: command.params[3],
129-
banned_at: command.params[4]
134+
banned_at: command.params[4],
135+
tags: command.tags
130136
});
131137
},
132138

@@ -145,15 +151,17 @@ var handlers = {
145151
RPL_TOPIC: function(command, handler) {
146152
handler.emit('topic', {
147153
channel: command.params[1],
148-
topic: command.params[command.params.length - 1]
154+
topic: command.params[command.params.length - 1],
155+
tags: command.tags
149156
});
150157
},
151158

152159

153160
RPL_NOTOPIC: function(command, handler) {
154161
handler.emit('topic', {
155162
channel: command.params[1],
156-
topic: ''
163+
topic: '',
164+
tags: command.tags
157165
});
158166
},
159167

@@ -165,7 +173,8 @@ var handlers = {
165173
ident: parsed.user,
166174
hostname: parsed.host,
167175
channel: command.params[1],
168-
when: command.params[3]
176+
when: command.params[3],
177+
tags: command.tags
169178
});
170179
},
171180

@@ -190,7 +199,7 @@ var handlers = {
190199
data.gecos = command.params[gecos_idx] || '';
191200
data.channel = channel;
192201
data.time = command.getServerTime();
193-
202+
data.tags = command.tags;
194203
handler.emit('join', data);
195204
},
196205

@@ -204,7 +213,8 @@ var handlers = {
204213
hostname: command.hostname,
205214
channel: command.params[0],
206215
message: command.params[command.params.length - 1] || '',
207-
time: time
216+
time: time,
217+
tags: command.tags
208218
});
209219
},
210220

@@ -219,7 +229,8 @@ var handlers = {
219229
hostname: command.hostname,
220230
channel: command.params[0],
221231
message: command.params[command.params.length - 1] || '',
222-
time: time
232+
time: time,
233+
tags: command.tags
223234
});
224235
},
225236

@@ -232,7 +243,8 @@ var handlers = {
232243
ident: command.ident,
233244
hostname: command.hostname,
234245
message: command.params[command.params.length - 1] || '',
235-
time: time
246+
time: time,
247+
tags: command.tags
236248
});
237249
},
238250

@@ -253,7 +265,8 @@ var handlers = {
253265
nick: command.nick,
254266
channel: channel,
255267
topic: topic,
256-
time: time
268+
time: time,
269+
tags: command.tags
257270
});
258271
},
259272

@@ -267,15 +280,17 @@ var handlers = {
267280
hostname: command.hostname,
268281
invited: command.params[0],
269282
channel: command.params[1],
270-
time: time
283+
time: time,
284+
tags: command.tags
271285
});
272286
},
273287

274288

275289
RPL_INVITING: function(command, handler) {
276290
handler.emit('invited', {
277291
nick: command.params[0],
278-
channel: command.params[1]
292+
channel: command.params[1],
293+
tags: command.tags
279294
});
280295
}
281296
};

src/commands/handlers/messaging.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ var handlers = {
2222
target: target,
2323
type: (message.substring(1, message.length - 1).split(' ') || [null])[0],
2424
message: message.substring(1, message.length - 1),
25-
time: time
25+
time: time,
26+
tags: command.tags
2627
});
2728
} else {
2829
var parsed_target = handler.network.extractTargetGroup(target);
@@ -98,7 +99,8 @@ var handlers = {
9899
type: ctcp_command || null,
99100
message: message.substring(1, message.length - 1),
100101
time: time,
101-
account: command.getTag('account')
102+
account: command.getTag('account'),
103+
tags: command.tags
102104
});
103105
}
104106
} else {
@@ -135,7 +137,8 @@ var handlers = {
135137
ident: command.ident,
136138
hostname: command.hostname,
137139
message: command.params[command.params.length - 1],
138-
account: command.getTag('account')
140+
account: command.getTag('account'),
141+
tags: command.tags
139142
});
140143
}
141144
};

src/commands/handlers/misc.js

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ var handlers = {
2929
cache.channels.push({
3030
channel: command.params[1],
3131
num_users: parseInt(command.params[2], 10),
32-
topic: command.params[3] || ''
32+
topic: command.params[3] || '',
33+
tags: command.tags
3334
});
3435

3536
if (cache.channels.length >= 50) {
@@ -53,7 +54,8 @@ var handlers = {
5354
RPL_ENDOFMOTD: function(command, handler) {
5455
var cache = handler.cache('motd');
5556
handler.emit('motd', {
56-
motd: cache.motd
57+
motd: cache.motd,
58+
tags: command.tags
5759
});
5860
cache.destroy();
5961
},
@@ -62,7 +64,8 @@ var handlers = {
6264
var params = _.clone(command.params);
6365
params.shift();
6466
handler.emit('motd', {
65-
error: command.params[command.params.length - 1]
67+
error: command.params[command.params.length - 1],
68+
tags: command.tags
6669
});
6770
},
6871

@@ -107,6 +110,7 @@ var handlers = {
107110
num_hops_away: hops_away,
108111
channel: params[1],
109112
channel_modes: chan_modes,
113+
tags: command.tags
110114
});
111115
},
112116

@@ -144,6 +148,7 @@ var handlers = {
144148
num_hops_away: parseInt(params[7], 10),
145149
channel: params[1],
146150
channel_modes: chan_modes,
151+
tags: command.tags
147152
});
148153
},
149154

@@ -173,6 +178,7 @@ var handlers = {
173178
handler.emit('pong', {
174179
message: command.params[1],
175180
time: time,
181+
tags: command.tags
176182
});
177183
},
178184

@@ -192,7 +198,8 @@ var handlers = {
192198
modes: modes,
193199
time: time,
194200
raw_modes: raw_modes,
195-
raw_params: raw_params
201+
raw_params: raw_params,
202+
tags: command.tags
196203
});
197204
},
198205

@@ -204,7 +211,8 @@ var handlers = {
204211
address: command.params[1],
205212
access_via: command.params[2],
206213
hops: parseInt(command.params[3].split(' ')[0]),
207-
description: command.params[3].split(' ').splice(1).join(' ')
214+
description: command.params[3].split(' ').splice(1).join(' '),
215+
tags: command.tags
208216
});
209217
},
210218

src/commands/handlers/registration.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ var handlers = {
2626
}
2727

2828
handler.emit('registered', {
29-
nick: nick
29+
nick: nick,
30+
tags: command.tags
3031
});
3132
},
3233

@@ -84,7 +85,8 @@ var handlers = {
8485

8586
handler.emit('server options', {
8687
options: handler.network.options,
87-
cap: handler.network.cap.enabled
88+
cap: handler.network.cap.enabled,
89+
tags: command.tags
8890
});
8991
},
9092

@@ -276,15 +278,17 @@ var handlers = {
276278
ident: mask.user,
277279
hostname: mask.host,
278280
account: command.params[2],
279-
time: time
281+
time: time,
282+
tags: command.tags
280283
});
281284

282285
handler.emit('account', {
283286
nick: command.params[0],
284287
ident: mask.user,
285288
hostname: mask.host,
286289
account: command.params[2],
287-
time: time
290+
time: time,
291+
tags: command.tags
288292
});
289293
},
290294

@@ -299,15 +303,17 @@ var handlers = {
299303
ident: mask.user,
300304
hostname: mask.host,
301305
account: false,
302-
time: time
306+
time: time,
307+
tags: command.tags
303308
});
304309

305310
handler.emit('account', {
306311
nick: command.params[0],
307312
ident: mask.user,
308313
hostname: mask.host,
309314
account: false,
310-
time: time
315+
time: time,
316+
tags: command.tags
311317
});
312318
},
313319

0 commit comments

Comments
 (0)