Merge lp:~julien-spautz/cable/irc-commands into lp:cable

Proposed by Julien Spautz
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
Reviewer Review Type Date Requested Status
Eduard Gotwig (community) Needs Fixing
Review via email: mp+180624@code.launchpad.net

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?

To post a comment you must log in.
Revision history for this message
Eduard Gotwig (gotwig) wrote :

Why can't you forward all commands, which beginn with a "/"?

Revision history for this message
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.

Revision history for this message
Eduard Gotwig (gotwig) wrote :

Ok, I think "/describe" is not there.

Also I found here a nice list: http://www.greenday.net/chat/commands.html .

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.

review: Needs Fixing
Revision history for this message
Marcus Lundgren (marcus-lundgren) wrote :

A list of the available IRC commands that might be of help: http://en.wikipedia.org/wiki/List_of_Internet_Relay_Chat_commands

At a glance, you seem to be missing /quit.

lp:~julien-spautz/cable/irc-commands updated
114. By Julien Spautz

a few more commands

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/Controller/Channel.vala'
--- src/Controller/Channel.vala 2013-08-08 00:37:02 +0000
+++ src/Controller/Channel.vala 2013-08-24 21:40:34 +0000
@@ -1,13 +1,33 @@
1/***
2 Copyright (C) 2013 Cable Developers
3
4 This program or library is free software; you can redistribute it
5 and/or modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 3 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General
15 Public License along with this library; if not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301 USA.
18***/
19
1internal class Cable.Controller.Channel : GLib.Object {20internal class Cable.Controller.Channel : GLib.Object {
221
3 internal weak Server server;22 internal weak Server server;
4 internal View.Channel view;23 internal View.Channel view;
5 internal Irc.Channel backend;24 internal Irc.Channel backend;
6 25
7 internal string name; //TODO id26 internal string name; //TODO id
827
9 internal Channel (Server server, string name) {28 internal Channel (Server server, string name) {
10debug (@"+ CONTROLLER CHANNEL $name");29 debug (@"+ CONTROLLER CHANNEL $name");
30
11 this.server = server;31 this.server = server;
12 this.name = name;32 this.name = name;
1333
@@ -51,8 +71,8 @@
51 }71 }
52 }72 }
5373
74 // GUI signals
54 void connect_frontend_signals () {75 void connect_frontend_signals () {
55
56 view.part.connect (() => {76 view.part.connect (() => {
57 backend.send_part ();77 backend.send_part ();
58 });78 });
@@ -69,7 +89,7 @@
6989
70 view.send_message.connect ((message) => {90 view.send_message.connect ((message) => {
71 if (message.has_prefix ("/"))91 if (message.has_prefix ("/"))
72 server.backend.send_raw (message.replace ("/", ""));92 send_command (message.replace ("/", ""));
73 else93 else
74 server.backend.send_message (name, message);94 server.backend.send_message (name, message);
7595
@@ -84,6 +104,7 @@
84104
85 }105 }
86106
107 // IRC signals
87 void connect_backend_signals () {108 void connect_backend_signals () {
88 backend.event_message.connect ((from, message) => {109 backend.event_message.connect ((from, message) => {
89 if (server.window.view.current_channel != view)110 if (server.window.view.current_channel != view)
@@ -98,7 +119,7 @@
98 if (server.backend.is_me (from)) {119 if (server.backend.is_me (from)) {
99 view.nick = new_nick;120 view.nick = new_nick;
100 }121 }
101 122
102 assert (new_nick != null);123 assert (new_nick != null);
103124
104 var name = from.split ("!")[0];125 var name = from.split ("!")[0];
@@ -165,6 +186,85 @@
165 }186 }
166 });187 });
167188
189 backend.event_action.connect ((from, message) => {
190 var nick = from.split ("!")[0];
191 view.message ("", "* " + nick + " " + message, MessageType.ACTION);
192 });
193
168 backend.event_names.connect (view.list_users);194 backend.event_names.connect (view.list_users);
169 }195 }
196
197 void send_command (string command) {
198
199 var args = command.split (" ");
200
201 switch (args[0]) {
202 case "join":
203 return_if_fail (args.length > 1);
204 var channel = new Channel (server, args[1]);
205 server.channels[args[1]] = channel;
206 server.window.view.current_channel = channel.view;
207 break;
208
209 case "part":
210 backend.send_part ();
211 break;
212
213 case "quit":
214 server.backend.send_quit ();
215 break;
216
217 case "nick":
218 return_if_fail (args.length > 1);
219 server.backend.send_nick (args[1]);
220 break;
221
222 case "topic":
223 return_if_fail (args.length > 1);
224 backend.send_topic (string.joinv (" ", args[1:-1]));
225 break;
226
227 case "me":
228 case "action":
229 return_if_fail (args.length > 1);
230 backend.send_action (string.joinv (" ", args[1:-1]));
231 break;
232
233 case "kick":
234 return_if_fail (args.length > 2);
235 backend.send_kick (args[1], string.joinv (" ", args[2:-1]));
236 break;
237
238 case "ignore":
239 return_if_fail (args.length > 1);
240 server.backend.send_ignore (string.joinv (" ", args[1:-1]));
241 break;
242
243 case "unignore":
244 return_if_fail (args.length > 1);
245 server.backend.send_unignore (string.joinv (" ", args[1:-1]));
246 break;
247
248 case "msg":
249 return_if_fail (args.length > 2);
250 server.backend.send_message (args[1], string.joinv (" ", args[2:-1]));
251 break;
252
253 case "notice":
254 return_if_fail (args.length > 2);
255 server.backend.send_notice (args[1], string.joinv (" ", args[2:-1]));
256 break;
257
258 case "away":
259 if (args.length < 2)
260 server.backend.send_back ();
261 else
262 server.backend.send_away (string.joinv (" ", args[1:-1]));
263 break;
264
265 default:
266 server.backend.send_raw (command);
267 break;
268 }
269 }
170}270}
171271
=== modified file 'src/Controller/Server.vala'
--- src/Controller/Server.vala 2013-08-20 19:51:01 +0000
+++ src/Controller/Server.vala 2013-08-24 21:40:34 +0000
@@ -1,3 +1,22 @@
1/***
2 Copyright (C) 2013 Cable Developers
3
4 This program or library is free software; you can redistribute it
5 and/or modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 3 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General
15 Public License along with this library; if not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301 USA.
18***/
19
1internal class Cable.Controller.Server : GLib.Object {20internal class Cable.Controller.Server : GLib.Object {
221
3 internal weak Window window;22 internal weak Window window;
423
=== modified file 'src/Controller/Window.vala'
--- src/Controller/Window.vala 2013-08-08 00:37:02 +0000
+++ src/Controller/Window.vala 2013-08-24 21:40:34 +0000
@@ -1,3 +1,22 @@
1/***
2 Copyright (C) 2013 Cable Developers
3
4 This program or library is free software; you can redistribute it
5 and/or modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 3 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General
15 Public License along with this library; if not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301 USA.
18***/
19
1internal class Cable.Controller.Window : GLib.Object {20internal class Cable.Controller.Window : GLib.Object {
221
3 internal View.Window view { get; set; }22 internal View.Window view { get; set; }
423
=== modified file 'src/Irc/Channel.vala'
--- src/Irc/Channel.vala 2013-08-06 15:32:12 +0000
+++ src/Irc/Channel.vala 2013-08-24 21:40:34 +0000
@@ -66,6 +66,7 @@
66 get { return name in server.channel_names; }66 get { return name in server.channel_names; }
67 }67 }
6868
69 public signal void event_action (string from, string message);
69 public signal void event_banlist (string mask, string who, int64 when); // TODO wtf is this?70 public signal void event_banlist (string mask, string who, int64 when); // TODO wtf is this?
7071
71 /**72 /**
@@ -264,6 +265,11 @@
264 }265 }
265 266
266 void setup_signals () {267 void setup_signals () {
268 client.event_action.connect ((time, server, from, target, message) => {
269 if (server == this.server.name && name == target)
270 event_action (from, message);
271 });
272
267 client.event_banlist.connect ((time, server, channel, mask, who, when) => {273 client.event_banlist.connect ((time, server, channel, mask, who, when) => {
268 if (server == this.server.name && name == channel)274 if (server == this.server.name && name == channel)
269 event_banlist (mask, who, when);275 event_banlist (mask, who, when);
270276
=== modified file 'src/Settings/Preferences.vala'
--- src/Settings/Preferences.vala 2013-08-20 14:28:43 +0000
+++ src/Settings/Preferences.vala 2013-08-24 21:40:34 +0000
@@ -1,3 +1,22 @@
1/***
2 Copyright (C) 2013 Cable Developers
3
4 This program or library is free software; you can redistribute it
5 and/or modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 3 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General
15 Public License along with this library; if not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301 USA.
18***/
19
1public class Cable.Settings.Preferences : Granite.Services.Settings {20public class Cable.Settings.Preferences : Granite.Services.Settings {
221
3 public string[] networks { get; set; }22 public string[] networks { get; set; }
423
=== modified file 'src/Settings/SavedState.vala'
--- src/Settings/SavedState.vala 2013-08-20 06:46:01 +0000
+++ src/Settings/SavedState.vala 2013-08-24 21:40:34 +0000
@@ -1,3 +1,4 @@
1<<<<<<< TREE
1public class Cable.Settings.SavedState : Granite.Services.Settings {2public class Cable.Settings.SavedState : Granite.Services.Settings {
23
3 public int window_width { get; set; }4 public int window_width { get; set; }
@@ -15,3 +16,24 @@
15 MAXIMIZED16 MAXIMIZED
16 }17 }
17}18}
19=======
20/***
21 Copyright (C) 2013 Cable Developers
22
23 This program or library is free software; you can redistribute it
24 and/or modify it under the terms of the GNU Lesser General Public
25 License as published by the Free Software Foundation; either
26 version 3 of the License, or (at your option) any later version.
27
28 This library is distributed in the hope that it will be useful,
29 but WITHOUT ANY WARRANTY; without even the implied warranty of
30 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
31 Lesser General Public License for more details.
32
33 You should have received a copy of the GNU Lesser General
34 Public License along with this library; if not, write to the
35 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
36 Boston, MA 02110-1301 USA.
37***/
38
39// XXX>>>>>>> MERGE-SOURCE
1840
=== modified file 'src/Tests/Tests.vala'
--- src/Tests/Tests.vala 2013-08-11 12:01:05 +0000
+++ src/Tests/Tests.vala 2013-08-24 21:40:34 +0000
@@ -1,3 +1,22 @@
1/***
2 Copyright (C) 2013 Cable Developers
3
4 This program or library is free software; you can redistribute it
5 and/or modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 3 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General
15 Public License along with this library; if not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301 USA.
18***/
19
1namespace Cable.Tests {20namespace Cable.Tests {
221
3 public int run (string[] args) {22 public int run (string[] args) {
423
=== modified file 'src/Tests/Utils.vala'
--- src/Tests/Utils.vala 2013-08-07 00:56:30 +0000
+++ src/Tests/Utils.vala 2013-08-24 21:40:34 +0000
@@ -1,3 +1,22 @@
1/***
2 Copyright (C) 2013 Cable Developers
3
4 This program or library is free software; you can redistribute it
5 and/or modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 3 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General
15 Public License along with this library; if not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301 USA.
18***/
19
1using Cable.Utils;20using Cable.Utils;
221
3namespace Cable.Tests.Utils {22namespace Cable.Tests.Utils {
423
=== modified file 'src/View/Channel.vala'
--- src/View/Channel.vala 2013-08-12 22:09:44 +0000
+++ src/View/Channel.vala 2013-08-24 21:40:34 +0000
@@ -1,3 +1,22 @@
1/***
2 Copyright (C) 2013 Cable Developers
3
4 This program or library is free software; you can redistribute it
5 and/or modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 3 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General
15 Public License along with this library; if not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301 USA.
18***/
19
1public interface Cable.View.Channel : GLib.Object {20public interface Cable.View.Channel : GLib.Object {
221
3 public abstract int unread_messages { get; set; }22 public abstract int unread_messages { get; set; }
423
=== modified file 'src/View/Server.vala'
--- src/View/Server.vala 2013-08-06 15:32:12 +0000
+++ src/View/Server.vala 2013-08-24 21:40:34 +0000
@@ -1,3 +1,22 @@
1/***
2 Copyright (C) 2013 Cable Developers
3
4 This program or library is free software; you can redistribute it
5 and/or modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 3 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General
15 Public License along with this library; if not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301 USA.
18***/
19
1public interface Cable.View.Server : GLib.Object {20public interface Cable.View.Server : GLib.Object {
221
3 // TODO parent-tier reference (i.e. window tier)22 // TODO parent-tier reference (i.e. window tier)
423
=== modified file 'src/View/Window.vala'
--- src/View/Window.vala 2013-08-06 15:32:12 +0000
+++ src/View/Window.vala 2013-08-24 21:40:34 +0000
@@ -1,3 +1,22 @@
1/***
2 Copyright (C) 2013 Cable Developers
3
4 This program or library is free software; you can redistribute it
5 and/or modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 3 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General
15 Public License along with this library; if not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301 USA.
18***/
19
1public interface Cable.View.Window : GLib.Object {20public interface Cable.View.Window : GLib.Object {
221
3 public abstract bool welcome_shown { get; set; }22 public abstract bool welcome_shown { get; set; }
423
=== modified file 'src/Widgets/ChatDisplay.vala'
--- src/Widgets/ChatDisplay.vala 2013-08-06 15:32:12 +0000
+++ src/Widgets/ChatDisplay.vala 2013-08-24 21:40:34 +0000
@@ -24,13 +24,15 @@
24 SUGGESTION,24 SUGGESTION,
25 NICK,25 NICK,
26 AWAY,26 AWAY,
27 PING;27 PING,
28 ACTION;
28 /* QUIT, KICK, BAN, MODE(?), ACTION29 /* QUIT, KICK, BAN, MODE(?), ACTION
29 */30 */
30 31
31 public string color () {32 public string color () {
32 switch (this) {33 switch (this) {
33 case NORMAL:34 case NORMAL:
35 case ACTION:
34 return "#333";36 return "#333";
35 case ENTER:37 case ENTER:
36 return "#9a9";38 return "#9a9";

Subscribers

People subscribed via source and target branches

to all changes: