Skip to content

Commit bcf77be

Browse files
committed
Add tags field to more irc events
1 parent 17415dd commit bcf77be

File tree

6 files changed

+82
-37
lines changed

6 files changed

+82
-37
lines changed

browser.js

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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: 9 additions & 4 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
},
@@ -175,6 +177,7 @@ var handlers = {
175177
handler.emit('pong', {
176178
message: command.params[1],
177179
time: time,
180+
tags: command.tags
178181
});
179182
},
180183

@@ -194,7 +197,8 @@ var handlers = {
194197
modes: modes,
195198
time: time,
196199
raw_modes: raw_modes,
197-
raw_params: raw_params
200+
raw_params: raw_params,
201+
tags: command.tags
198202
});
199203
},
200204

@@ -206,7 +210,8 @@ var handlers = {
206210
address: command.params[1],
207211
access_via: command.params[2],
208212
hops: parseInt(command.params[3].split(' ')[0]),
209-
description: command.params[3].split(' ').splice(1).join(' ')
213+
description: command.params[3].split(' ').splice(1).join(' '),
214+
tags: command.tags
210215
});
211216
},
212217

src/commands/handlers/registration.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -276,15 +276,17 @@ var handlers = {
276276
ident: mask.user,
277277
hostname: mask.host,
278278
account: command.params[2],
279-
time: time
279+
time: time,
280+
tags: command.tags
280281
});
281282

282283
handler.emit('account', {
283284
nick: command.params[0],
284285
ident: mask.user,
285286
hostname: mask.host,
286287
account: command.params[2],
287-
time: time
288+
time: time,
289+
tags: command.tags
288290
});
289291
},
290292

@@ -299,15 +301,17 @@ var handlers = {
299301
ident: mask.user,
300302
hostname: mask.host,
301303
account: false,
302-
time: time
304+
time: time,
305+
tags: command.tags
303306
});
304307

305308
handler.emit('account', {
306309
nick: command.params[0],
307310
ident: mask.user,
308311
hostname: mask.host,
309312
account: false,
310-
time: time
313+
time: time,
314+
tags: command.tags
311315
});
312316
},
313317

src/commands/handlers/user.js

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ var handlers = {
1616
ident: command.ident,
1717
hostname: command.hostname,
1818
new_nick: command.params[0],
19-
time: time
19+
time: time,
20+
tags: command.tags
2021
});
2122
},
2223

@@ -35,7 +36,8 @@ var handlers = {
3536
ident: command.ident,
3637
hostname: command.hostname,
3738
account: account,
38-
time: time
39+
time: time,
40+
tags: command.tags
3941
});
4042
},
4143

@@ -52,7 +54,8 @@ var handlers = {
5254
hostname: command.hostname,
5355
new_ident: command.params[0],
5456
new_hostname: command.params[1],
55-
time: time
57+
time: time,
58+
tags: command.tags
5659
});
5760
},
5861

@@ -67,7 +70,8 @@ var handlers = {
6770
ident: command.ident,
6871
hostname: command.hostname,
6972
new_gecos: command.params[0],
70-
time: time
73+
time: time,
74+
tags: command.tags
7175
});
7276
},
7377

@@ -82,14 +86,16 @@ var handlers = {
8286
self: false,
8387
nick: command.nick,
8488
message: '',
85-
time: time
89+
time: time,
90+
tags: command.tags
8691
});
8792
} else {
8893
handler.emit('away', {
8994
self: false,
9095
nick: command.nick,
9196
message: message,
92-
time: time
97+
time: time,
98+
tags: command.tags
9399
});
94100
}
95101
},
@@ -104,7 +110,8 @@ var handlers = {
104110
self: true,
105111
nick: command.params[0],
106112
message: command.params[1] || '',
107-
time: time
113+
time: time,
114+
tags: command.tags,
108115
});
109116
},
110117

@@ -118,7 +125,8 @@ var handlers = {
118125
self: true,
119126
nick: command.params[0],
120127
message: command.params[1] || '', // example: "<nick> is now back."
121-
time: time
128+
time: time,
129+
tags: command.tags
122130
});
123131
},
124132

@@ -171,7 +179,8 @@ var handlers = {
171179
self: false,
172180
nick: command.params[1],
173181
message: message,
174-
time: time
182+
time: time,
183+
tags: command.tags
175184
});
176185

177186
return;
@@ -353,7 +362,8 @@ var handlers = {
353362
RPL_HOSTCLOAKING: function(command, handler) {
354363
handler.emit('displayed host', {
355364
nick: command.params[0],
356-
hostname: command.params[1]
365+
hostname: command.params[1],
366+
tags: command.tags
357367
});
358368
}
359369
};

0 commit comments

Comments
 (0)