Merge lp:~julien-spautz/cable/irc-commands into lp:cable
- irc-commands
- Merge into trunk
Status: | Merged | ||||
---|---|---|---|---|---|
Merged at revision: | 122 | ||||
Proposed branch: | lp:~julien-spautz/cable/irc-commands | ||||
Merge into: | lp:cable | ||||
Diff against target: |
456 lines (+288/-6) (has conflicts) 12 files modified
src/Controller/Channel.vala (+105/-5) src/Controller/Server.vala (+19/-0) src/Controller/Window.vala (+19/-0) src/Irc/Channel.vala (+6/-0) src/Settings/Preferences.vala (+19/-0) src/Settings/SavedState.vala (+22/-0) src/Tests/Tests.vala (+19/-0) src/Tests/Utils.vala (+19/-0) src/View/Channel.vala (+19/-0) src/View/Server.vala (+19/-0) src/View/Window.vala (+19/-0) src/Widgets/ChatDisplay.vala (+3/-1) Text conflict in src/Settings/SavedState.vala |
||||
To merge this branch: | bzr merge lp:~julien-spautz/cable/irc-commands | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Eduard Gotwig (community) | Needs Fixing | ||
Review via email: mp+180624@code.launchpad.net |
Commit message
Description of the change
Started implementing irc commands. Also added support for actions (/me or /action) because they where not displayed previously. Also added missing copyright headers.
I only implemented a few commands so far, which should I add next?
Eduard Gotwig (gotwig) wrote : | # |
Julien Spautz (julien-spautz) wrote : | # |
It does forward all unknown commands.
Some commands, like /me, do not exits in the IRC protocol, so you can't just forward them, if that's what you mean.
Eduard Gotwig (gotwig) wrote : | # |
Ok, I think "/describe" is not there.
Also I found here a nice list: http://
Also, for autocompletition, it should first check if the entry is free, does not contain any charachters, and only than add ":" to the username. Else it should just autocomplete the username, without :.
Example: if you type /describe ma<TAB> the result is
/describe max: instead of /describe max, so the user has to remove the ":" manually.
This also happens when you want to refer to a user, in the chat.
example: Hello ma<TAB>
results in Hello max: .
This is not what we want, instead we want "Hello max".
Thanks for your work Julien, it seems to work for me.
Marcus Lundgren (marcus-lundgren) wrote : | # |
A list of the available IRC commands that might be of help: http://
At a glance, you seem to be missing /quit.
- 114. By Julien Spautz
-
a few more commands
Preview Diff
1 | === modified file 'src/Controller/Channel.vala' |
2 | --- src/Controller/Channel.vala 2013-08-08 00:37:02 +0000 |
3 | +++ src/Controller/Channel.vala 2013-08-24 21:40:34 +0000 |
4 | @@ -1,13 +1,33 @@ |
5 | +/*** |
6 | + Copyright (C) 2013 Cable Developers |
7 | + |
8 | + This program or library is free software; you can redistribute it |
9 | + and/or modify it under the terms of the GNU Lesser General Public |
10 | + License as published by the Free Software Foundation; either |
11 | + version 3 of the License, or (at your option) any later version. |
12 | + |
13 | + This library is distributed in the hope that it will be useful, |
14 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
16 | + Lesser General Public License for more details. |
17 | + |
18 | + You should have received a copy of the GNU Lesser General |
19 | + Public License along with this library; if not, write to the |
20 | + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
21 | + Boston, MA 02110-1301 USA. |
22 | +***/ |
23 | + |
24 | internal class Cable.Controller.Channel : GLib.Object { |
25 | |
26 | internal weak Server server; |
27 | internal View.Channel view; |
28 | internal Irc.Channel backend; |
29 | - |
30 | + |
31 | internal string name; //TODO id |
32 | |
33 | internal Channel (Server server, string name) { |
34 | -debug (@"+ CONTROLLER CHANNEL $name"); |
35 | + debug (@"+ CONTROLLER CHANNEL $name"); |
36 | + |
37 | this.server = server; |
38 | this.name = name; |
39 | |
40 | @@ -51,8 +71,8 @@ |
41 | } |
42 | } |
43 | |
44 | + // GUI signals |
45 | void connect_frontend_signals () { |
46 | - |
47 | view.part.connect (() => { |
48 | backend.send_part (); |
49 | }); |
50 | @@ -69,7 +89,7 @@ |
51 | |
52 | view.send_message.connect ((message) => { |
53 | if (message.has_prefix ("/")) |
54 | - server.backend.send_raw (message.replace ("/", "")); |
55 | + send_command (message.replace ("/", "")); |
56 | else |
57 | server.backend.send_message (name, message); |
58 | |
59 | @@ -84,6 +104,7 @@ |
60 | |
61 | } |
62 | |
63 | + // IRC signals |
64 | void connect_backend_signals () { |
65 | backend.event_message.connect ((from, message) => { |
66 | if (server.window.view.current_channel != view) |
67 | @@ -98,7 +119,7 @@ |
68 | if (server.backend.is_me (from)) { |
69 | view.nick = new_nick; |
70 | } |
71 | - |
72 | + |
73 | assert (new_nick != null); |
74 | |
75 | var name = from.split ("!")[0]; |
76 | @@ -165,6 +186,85 @@ |
77 | } |
78 | }); |
79 | |
80 | + backend.event_action.connect ((from, message) => { |
81 | + var nick = from.split ("!")[0]; |
82 | + view.message ("", "* " + nick + " " + message, MessageType.ACTION); |
83 | + }); |
84 | + |
85 | backend.event_names.connect (view.list_users); |
86 | } |
87 | + |
88 | + void send_command (string command) { |
89 | + |
90 | + var args = command.split (" "); |
91 | + |
92 | + switch (args[0]) { |
93 | + case "join": |
94 | + return_if_fail (args.length > 1); |
95 | + var channel = new Channel (server, args[1]); |
96 | + server.channels[args[1]] = channel; |
97 | + server.window.view.current_channel = channel.view; |
98 | + break; |
99 | + |
100 | + case "part": |
101 | + backend.send_part (); |
102 | + break; |
103 | + |
104 | + case "quit": |
105 | + server.backend.send_quit (); |
106 | + break; |
107 | + |
108 | + case "nick": |
109 | + return_if_fail (args.length > 1); |
110 | + server.backend.send_nick (args[1]); |
111 | + break; |
112 | + |
113 | + case "topic": |
114 | + return_if_fail (args.length > 1); |
115 | + backend.send_topic (string.joinv (" ", args[1:-1])); |
116 | + break; |
117 | + |
118 | + case "me": |
119 | + case "action": |
120 | + return_if_fail (args.length > 1); |
121 | + backend.send_action (string.joinv (" ", args[1:-1])); |
122 | + break; |
123 | + |
124 | + case "kick": |
125 | + return_if_fail (args.length > 2); |
126 | + backend.send_kick (args[1], string.joinv (" ", args[2:-1])); |
127 | + break; |
128 | + |
129 | + case "ignore": |
130 | + return_if_fail (args.length > 1); |
131 | + server.backend.send_ignore (string.joinv (" ", args[1:-1])); |
132 | + break; |
133 | + |
134 | + case "unignore": |
135 | + return_if_fail (args.length > 1); |
136 | + server.backend.send_unignore (string.joinv (" ", args[1:-1])); |
137 | + break; |
138 | + |
139 | + case "msg": |
140 | + return_if_fail (args.length > 2); |
141 | + server.backend.send_message (args[1], string.joinv (" ", args[2:-1])); |
142 | + break; |
143 | + |
144 | + case "notice": |
145 | + return_if_fail (args.length > 2); |
146 | + server.backend.send_notice (args[1], string.joinv (" ", args[2:-1])); |
147 | + break; |
148 | + |
149 | + case "away": |
150 | + if (args.length < 2) |
151 | + server.backend.send_back (); |
152 | + else |
153 | + server.backend.send_away (string.joinv (" ", args[1:-1])); |
154 | + break; |
155 | + |
156 | + default: |
157 | + server.backend.send_raw (command); |
158 | + break; |
159 | + } |
160 | + } |
161 | } |
162 | |
163 | === modified file 'src/Controller/Server.vala' |
164 | --- src/Controller/Server.vala 2013-08-20 19:51:01 +0000 |
165 | +++ src/Controller/Server.vala 2013-08-24 21:40:34 +0000 |
166 | @@ -1,3 +1,22 @@ |
167 | +/*** |
168 | + Copyright (C) 2013 Cable Developers |
169 | + |
170 | + This program or library is free software; you can redistribute it |
171 | + and/or modify it under the terms of the GNU Lesser General Public |
172 | + License as published by the Free Software Foundation; either |
173 | + version 3 of the License, or (at your option) any later version. |
174 | + |
175 | + This library is distributed in the hope that it will be useful, |
176 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
177 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
178 | + Lesser General Public License for more details. |
179 | + |
180 | + You should have received a copy of the GNU Lesser General |
181 | + Public License along with this library; if not, write to the |
182 | + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
183 | + Boston, MA 02110-1301 USA. |
184 | +***/ |
185 | + |
186 | internal class Cable.Controller.Server : GLib.Object { |
187 | |
188 | internal weak Window window; |
189 | |
190 | === modified file 'src/Controller/Window.vala' |
191 | --- src/Controller/Window.vala 2013-08-08 00:37:02 +0000 |
192 | +++ src/Controller/Window.vala 2013-08-24 21:40:34 +0000 |
193 | @@ -1,3 +1,22 @@ |
194 | +/*** |
195 | + Copyright (C) 2013 Cable Developers |
196 | + |
197 | + This program or library is free software; you can redistribute it |
198 | + and/or modify it under the terms of the GNU Lesser General Public |
199 | + License as published by the Free Software Foundation; either |
200 | + version 3 of the License, or (at your option) any later version. |
201 | + |
202 | + This library is distributed in the hope that it will be useful, |
203 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
204 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
205 | + Lesser General Public License for more details. |
206 | + |
207 | + You should have received a copy of the GNU Lesser General |
208 | + Public License along with this library; if not, write to the |
209 | + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
210 | + Boston, MA 02110-1301 USA. |
211 | +***/ |
212 | + |
213 | internal class Cable.Controller.Window : GLib.Object { |
214 | |
215 | internal View.Window view { get; set; } |
216 | |
217 | === modified file 'src/Irc/Channel.vala' |
218 | --- src/Irc/Channel.vala 2013-08-06 15:32:12 +0000 |
219 | +++ src/Irc/Channel.vala 2013-08-24 21:40:34 +0000 |
220 | @@ -66,6 +66,7 @@ |
221 | get { return name in server.channel_names; } |
222 | } |
223 | |
224 | + public signal void event_action (string from, string message); |
225 | public signal void event_banlist (string mask, string who, int64 when); // TODO wtf is this? |
226 | |
227 | /** |
228 | @@ -264,6 +265,11 @@ |
229 | } |
230 | |
231 | void setup_signals () { |
232 | + client.event_action.connect ((time, server, from, target, message) => { |
233 | + if (server == this.server.name && name == target) |
234 | + event_action (from, message); |
235 | + }); |
236 | + |
237 | client.event_banlist.connect ((time, server, channel, mask, who, when) => { |
238 | if (server == this.server.name && name == channel) |
239 | event_banlist (mask, who, when); |
240 | |
241 | === modified file 'src/Settings/Preferences.vala' |
242 | --- src/Settings/Preferences.vala 2013-08-20 14:28:43 +0000 |
243 | +++ src/Settings/Preferences.vala 2013-08-24 21:40:34 +0000 |
244 | @@ -1,3 +1,22 @@ |
245 | +/*** |
246 | + Copyright (C) 2013 Cable Developers |
247 | + |
248 | + This program or library is free software; you can redistribute it |
249 | + and/or modify it under the terms of the GNU Lesser General Public |
250 | + License as published by the Free Software Foundation; either |
251 | + version 3 of the License, or (at your option) any later version. |
252 | + |
253 | + This library is distributed in the hope that it will be useful, |
254 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
255 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
256 | + Lesser General Public License for more details. |
257 | + |
258 | + You should have received a copy of the GNU Lesser General |
259 | + Public License along with this library; if not, write to the |
260 | + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
261 | + Boston, MA 02110-1301 USA. |
262 | +***/ |
263 | + |
264 | public class Cable.Settings.Preferences : Granite.Services.Settings { |
265 | |
266 | public string[] networks { get; set; } |
267 | |
268 | === modified file 'src/Settings/SavedState.vala' |
269 | --- src/Settings/SavedState.vala 2013-08-20 06:46:01 +0000 |
270 | +++ src/Settings/SavedState.vala 2013-08-24 21:40:34 +0000 |
271 | @@ -1,3 +1,4 @@ |
272 | +<<<<<<< TREE |
273 | public class Cable.Settings.SavedState : Granite.Services.Settings { |
274 | |
275 | public int window_width { get; set; } |
276 | @@ -15,3 +16,24 @@ |
277 | MAXIMIZED |
278 | } |
279 | } |
280 | +======= |
281 | +/*** |
282 | + Copyright (C) 2013 Cable Developers |
283 | + |
284 | + This program or library is free software; you can redistribute it |
285 | + and/or modify it under the terms of the GNU Lesser General Public |
286 | + License as published by the Free Software Foundation; either |
287 | + version 3 of the License, or (at your option) any later version. |
288 | + |
289 | + This library is distributed in the hope that it will be useful, |
290 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
291 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
292 | + Lesser General Public License for more details. |
293 | + |
294 | + You should have received a copy of the GNU Lesser General |
295 | + Public License along with this library; if not, write to the |
296 | + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
297 | + Boston, MA 02110-1301 USA. |
298 | +***/ |
299 | + |
300 | +// XXX>>>>>>> MERGE-SOURCE |
301 | |
302 | === modified file 'src/Tests/Tests.vala' |
303 | --- src/Tests/Tests.vala 2013-08-11 12:01:05 +0000 |
304 | +++ src/Tests/Tests.vala 2013-08-24 21:40:34 +0000 |
305 | @@ -1,3 +1,22 @@ |
306 | +/*** |
307 | + Copyright (C) 2013 Cable Developers |
308 | + |
309 | + This program or library is free software; you can redistribute it |
310 | + and/or modify it under the terms of the GNU Lesser General Public |
311 | + License as published by the Free Software Foundation; either |
312 | + version 3 of the License, or (at your option) any later version. |
313 | + |
314 | + This library is distributed in the hope that it will be useful, |
315 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
316 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
317 | + Lesser General Public License for more details. |
318 | + |
319 | + You should have received a copy of the GNU Lesser General |
320 | + Public License along with this library; if not, write to the |
321 | + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
322 | + Boston, MA 02110-1301 USA. |
323 | +***/ |
324 | + |
325 | namespace Cable.Tests { |
326 | |
327 | public int run (string[] args) { |
328 | |
329 | === modified file 'src/Tests/Utils.vala' |
330 | --- src/Tests/Utils.vala 2013-08-07 00:56:30 +0000 |
331 | +++ src/Tests/Utils.vala 2013-08-24 21:40:34 +0000 |
332 | @@ -1,3 +1,22 @@ |
333 | +/*** |
334 | + Copyright (C) 2013 Cable Developers |
335 | + |
336 | + This program or library is free software; you can redistribute it |
337 | + and/or modify it under the terms of the GNU Lesser General Public |
338 | + License as published by the Free Software Foundation; either |
339 | + version 3 of the License, or (at your option) any later version. |
340 | + |
341 | + This library is distributed in the hope that it will be useful, |
342 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
343 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
344 | + Lesser General Public License for more details. |
345 | + |
346 | + You should have received a copy of the GNU Lesser General |
347 | + Public License along with this library; if not, write to the |
348 | + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
349 | + Boston, MA 02110-1301 USA. |
350 | +***/ |
351 | + |
352 | using Cable.Utils; |
353 | |
354 | namespace Cable.Tests.Utils { |
355 | |
356 | === modified file 'src/View/Channel.vala' |
357 | --- src/View/Channel.vala 2013-08-12 22:09:44 +0000 |
358 | +++ src/View/Channel.vala 2013-08-24 21:40:34 +0000 |
359 | @@ -1,3 +1,22 @@ |
360 | +/*** |
361 | + Copyright (C) 2013 Cable Developers |
362 | + |
363 | + This program or library is free software; you can redistribute it |
364 | + and/or modify it under the terms of the GNU Lesser General Public |
365 | + License as published by the Free Software Foundation; either |
366 | + version 3 of the License, or (at your option) any later version. |
367 | + |
368 | + This library is distributed in the hope that it will be useful, |
369 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
370 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
371 | + Lesser General Public License for more details. |
372 | + |
373 | + You should have received a copy of the GNU Lesser General |
374 | + Public License along with this library; if not, write to the |
375 | + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
376 | + Boston, MA 02110-1301 USA. |
377 | +***/ |
378 | + |
379 | public interface Cable.View.Channel : GLib.Object { |
380 | |
381 | public abstract int unread_messages { get; set; } |
382 | |
383 | === modified file 'src/View/Server.vala' |
384 | --- src/View/Server.vala 2013-08-06 15:32:12 +0000 |
385 | +++ src/View/Server.vala 2013-08-24 21:40:34 +0000 |
386 | @@ -1,3 +1,22 @@ |
387 | +/*** |
388 | + Copyright (C) 2013 Cable Developers |
389 | + |
390 | + This program or library is free software; you can redistribute it |
391 | + and/or modify it under the terms of the GNU Lesser General Public |
392 | + License as published by the Free Software Foundation; either |
393 | + version 3 of the License, or (at your option) any later version. |
394 | + |
395 | + This library is distributed in the hope that it will be useful, |
396 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
397 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
398 | + Lesser General Public License for more details. |
399 | + |
400 | + You should have received a copy of the GNU Lesser General |
401 | + Public License along with this library; if not, write to the |
402 | + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
403 | + Boston, MA 02110-1301 USA. |
404 | +***/ |
405 | + |
406 | public interface Cable.View.Server : GLib.Object { |
407 | |
408 | // TODO parent-tier reference (i.e. window tier) |
409 | |
410 | === modified file 'src/View/Window.vala' |
411 | --- src/View/Window.vala 2013-08-06 15:32:12 +0000 |
412 | +++ src/View/Window.vala 2013-08-24 21:40:34 +0000 |
413 | @@ -1,3 +1,22 @@ |
414 | +/*** |
415 | + Copyright (C) 2013 Cable Developers |
416 | + |
417 | + This program or library is free software; you can redistribute it |
418 | + and/or modify it under the terms of the GNU Lesser General Public |
419 | + License as published by the Free Software Foundation; either |
420 | + version 3 of the License, or (at your option) any later version. |
421 | + |
422 | + This library is distributed in the hope that it will be useful, |
423 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
424 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
425 | + Lesser General Public License for more details. |
426 | + |
427 | + You should have received a copy of the GNU Lesser General |
428 | + Public License along with this library; if not, write to the |
429 | + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
430 | + Boston, MA 02110-1301 USA. |
431 | +***/ |
432 | + |
433 | public interface Cable.View.Window : GLib.Object { |
434 | |
435 | public abstract bool welcome_shown { get; set; } |
436 | |
437 | === modified file 'src/Widgets/ChatDisplay.vala' |
438 | --- src/Widgets/ChatDisplay.vala 2013-08-06 15:32:12 +0000 |
439 | +++ src/Widgets/ChatDisplay.vala 2013-08-24 21:40:34 +0000 |
440 | @@ -24,13 +24,15 @@ |
441 | SUGGESTION, |
442 | NICK, |
443 | AWAY, |
444 | - PING; |
445 | + PING, |
446 | + ACTION; |
447 | /* QUIT, KICK, BAN, MODE(?), ACTION |
448 | */ |
449 | |
450 | public string color () { |
451 | switch (this) { |
452 | case NORMAL: |
453 | + case ACTION: |
454 | return "#333"; |
455 | case ENTER: |
456 | return "#9a9"; |
Why can't you forward all commands, which beginn with a "/"?