Merge lp:~marco-92/do-plugins/XChat into lp:do-plugins

Proposed by Marco A. Peraza
Status: Rejected
Rejected by: Alex Launi
Proposed branch: lp:~marco-92/do-plugins/XChat
Merge into: lp:do-plugins
Diff against target: None lines
To merge this branch: bzr merge lp:~marco-92/do-plugins/XChat
Reviewer Review Type Date Requested Status
Chris S. Needs Fixing
Review via email: mp+7053@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Marco A. Peraza (marco-92) wrote :

This is an XChat plugin for Do. It lets users connect to and disconnect from IRC servers and also allows them to send messages to users or channels.

lp:~marco-92/do-plugins/XChat updated
626. By Marco A. Peraza

Fix accidental modification of unrelated plugins

627. By Marco A. Peraza

Allow Text and Channel/User to be either item or moditem in Message action

Revision history for this message
Chris S. (cszikszoy) wrote :

I haven't tested the plugin in Do, but some initial comments:

* Please follow the mono style guidelines: http://www.mono-project.com/Coding_Guidelines
* Use static methods to interface with XChat over dbus, this way you don't have to create a new dbus object everywhere you want to perform some XChat action. Take a look at how the Pidgin plugin uses dbus (Pidgin.cs).
* Use Catalog.GetString ("some string"); for all public strings. (IE: strings that the user sees)
* Maybe the XChatUserItems could inherit from IContactDetailItem instead. Then in your code where you list the users in a channel, use users.add (ContactItem.Create ()). Again, take a look at how pidgin does this (PidginContactItemSource.cs & PiginHandleContactDetailItem.cs)
* Also please integrate your plugin into the build system. You need to make a "Makefile.am" file in your xchat directory, and add your plugin to Makefile.am and configure.ac (both in the root do-plugins dir).

review: Needs Fixing
Revision history for this message
Alex Launi (alexlauni) wrote :

Ping? Hello? Is this branch abandoned? Please fix as per chris' review :)

Unmerged revisions

627. By Marco A. Peraza

Allow Text and Channel/User to be either item or moditem in Message action

626. By Marco A. Peraza

Fix accidental modification of unrelated plugins

625. By Marco A. Peraza

Cleanup and renaming

624. By Marco A. Peraza

Add User support and make servers display network name.

623. By Marco A. Peraza

Add User support. Make servers display network name.

622. By Marco A. Peraza

Merge

621. By Marco A. Peraza

Make channel descriptions more descriptive

620. By Marco A. Peraza

Make XChatConnectAction not lock up Do if XChat isn't running.

619. By Marco A. Peraza

Really add Channel support. Fix behavior when XChat is not open.

618. By Marco A. Peraza

Added XChatChannelItem(Source) and XChatMessageAction

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'DoPlugins.mds'
2--- DoPlugins.mds 2009-05-27 04:41:20 +0000
3+++ DoPlugins.mds 2009-06-03 14:39:26 +0000
4@@ -72,6 +72,7 @@
5 <Entry build="True" name="YouTube" configuration="Debug" />
6 <Entry build="True" name="Emesene" configuration="Debug" />
7 <Entry build="True" name="RemindMe" configuration="Debug" />
8+ <Entry build="True" name="XChat" configuration="Debug" />
9 </Configuration>
10 <Configuration name="Release" ctype="CombineConfiguration">
11 <Entry build="True" name="Rhythmbox" configuration="Release" />
12@@ -145,6 +146,7 @@
13 <Entry build="True" name="YouTube" configuration="Release" />
14 <Entry build="True" name="Emesene" configuration="Release" />
15 <Entry build="True" name="RemindMe" configuration="Release" />
16+ <Entry build="True" name="XChat" configuration="Release" />
17 </Configuration>
18 </Configurations>
19 <StartMode startupentry="Rhythmbox" single="True">
20@@ -219,6 +221,7 @@
21 <Execute type="None" entry="YouTube" />
22 <Execute type="None" entry="Emesene" />
23 <Execute type="None" entry="RemindMe" />
24+ <Execute type="None" entry="XChat" />
25 </StartMode>
26 <MonoDevelop.ChangeLogAddIn.ChangeLogInfo policy="UpdateNearestChangeLog" />
27 <Entries>
28@@ -293,5 +296,6 @@
29 <Entry filename="YouTube/YouTube.mdp" />
30 <Entry filename="Emesene/Emesene.mdp" />
31 <Entry filename="RemindMe/RemindMe.mdp" />
32+ <Entry filename="XChat/XChat.mdp" />
33 </Entries>
34 </Combine>
35\ No newline at end of file
36
37=== modified file 'GoogleContacts/GMailContacts.mdp'
38--- GoogleContacts/GMailContacts.mdp 2009-05-17 08:45:38 +0000
39+++ GoogleContacts/GMailContacts.mdp 2009-06-03 17:18:24 +0000
40@@ -43,8 +43,8 @@
41 <ProjectReference type="Assembly" localcopy="True" refto="../BundledLibraries/Google.GData.Contacts.dll" />
42 <ProjectReference type="Assembly" localcopy="True" refto="../BundledLibraries/Google.GData.Extensions.dll" />
43 <ProjectReference type="Gac" localcopy="True" refto="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
44- <ProjectReference type="Assembly" localcopy="True" specificVersion="False" refto="../../../../../../usr/local/lib/gnome-do/Do.Platform.dll" />
45- <ProjectReference type="Assembly" localcopy="True" specificVersion="False" refto="../../../../../../usr/local/lib/gnome-do/Do.Platform.Linux.dll" />
46- <ProjectReference type="Assembly" localcopy="True" specificVersion="False" refto="../../../../../../usr/local/lib/gnome-do/Do.Universe.dll" />
47+ <ProjectReference type="Assembly" localcopy="True" specificVersion="False" refto="usr/local/lib/gnome-do/Do.Platform.dll" />
48+ <ProjectReference type="Assembly" localcopy="True" specificVersion="False" refto="usr/local/lib/gnome-do/Do.Platform.Linux.dll" />
49+ <ProjectReference type="Assembly" localcopy="True" specificVersion="False" refto="usr/local/lib/gnome-do/Do.Universe.dll" />
50 </References>
51 </Project>
52\ No newline at end of file
53
54=== modified file 'RemindMe/RemindMe.mdp'
55--- RemindMe/RemindMe.mdp 2009-05-16 01:07:13 +0000
56+++ RemindMe/RemindMe.mdp 2009-06-03 17:18:24 +0000
57@@ -27,9 +27,9 @@
58 <References>
59 <ProjectReference type="Gac" localcopy="True" refto="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
60 <ProjectReference type="Gac" localcopy="True" refto="glib-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
61- <ProjectReference type="Assembly" localcopy="True" specificVersion="False" refto="../../../../../../usr/local/lib/gnome-do/Do.Platform.dll" />
62- <ProjectReference type="Assembly" localcopy="True" specificVersion="False" refto="../../../../../../usr/local/lib/gnome-do/Do.Platform.Linux.dll" />
63- <ProjectReference type="Assembly" localcopy="True" specificVersion="False" refto="../../../../../../usr/local/lib/gnome-do/Do.Universe.dll" />
64+ <ProjectReference type="Assembly" localcopy="True" specificVersion="False" refto="usr/local/lib/gnome-do/Do.Platform.dll" />
65+ <ProjectReference type="Assembly" localcopy="True" specificVersion="False" refto="usr/local/lib/gnome-do/Do.Platform.Linux.dll" />
66+ <ProjectReference type="Assembly" localcopy="True" specificVersion="False" refto="usr/local/lib/gnome-do/Do.Universe.dll" />
67 <ProjectReference type="Gac" localcopy="True" refto="Mono.Posix, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />
68 <ProjectReference type="Gac" localcopy="True" refto="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
69 </References>
70
71=== added directory 'XChat'
72=== added file 'XChat/AssemblyInfo.cs'
73--- XChat/AssemblyInfo.cs 1970-01-01 00:00:00 +0000
74+++ XChat/AssemblyInfo.cs 2009-06-03 14:39:26 +0000
75@@ -0,0 +1,26 @@
76+using System.Reflection;
77+using System.Runtime.CompilerServices;
78+
79+// Information about this assembly is defined by the following attributes.
80+// Change them to the values specific to your project.
81+
82+[assembly: AssemblyTitle("XChat")]
83+[assembly: AssemblyDescription("")]
84+[assembly: AssemblyConfiguration("")]
85+[assembly: AssemblyCompany("")]
86+[assembly: AssemblyProduct("")]
87+[assembly: AssemblyCopyright("")]
88+[assembly: AssemblyTrademark("")]
89+[assembly: AssemblyCulture("")]
90+
91+// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
92+// The form "{Major}.{Minor}.*" will automatically update the build and revision,
93+// and "{Major}.{Minor}.{Build}.*" will update just the revision.
94+
95+[assembly: AssemblyVersion("1.0.*")]
96+
97+// The following attributes are used to specify the signing key for the assembly,
98+// if desired. See the Mono documentation for more information about signing.
99+
100+[assembly: AssemblyDelaySign(false)]
101+[assembly: AssemblyKeyFile("")]
102
103=== added directory 'XChat/Resources'
104=== added file 'XChat/Resources/XChat.addin.xml'
105--- XChat/Resources/XChat.addin.xml 1970-01-01 00:00:00 +0000
106+++ XChat/Resources/XChat.addin.xml 2009-06-03 17:18:24 +0000
107@@ -0,0 +1,31 @@
108+<Addin
109+ id="XChat"
110+ namespace="Do"
111+ version="0.1"
112+ name="XChat"
113+ description="Manage XChat."
114+ author="Marco Peraza"
115+ category="Community"
116+ defaultEnabled="false"
117+>
118+
119+ <Runtime>
120+ <Import assembly="XChat.dll"/>
121+ </Runtime>
122+
123+ <Dependencies>
124+ <Addin id="Universe" version="1.0" />
125+ </Dependencies>
126+
127+ <Extension path="/Do/ItemSource">
128+ <ItemSource type="XChatPlugin.XChatConnectionItemSource" />
129+ <ItemSource type="XChatPlugin.XChatChannelItemSource" />
130+ </Extension>
131+
132+ <Extension path= "/Do/Action">
133+ <Action type="XChatPlugin.XChatDisconnectAction" />
134+ <Action type="XChatPlugin.XChatConnectAction" />
135+ <Action type="XChatPlugin.XChatMessageAction" />
136+ </Extension>
137+
138+</Addin>
139\ No newline at end of file
140
141=== added file 'XChat/XChat.mdp'
142--- XChat/XChat.mdp 1970-01-01 00:00:00 +0000
143+++ XChat/XChat.mdp 2009-06-03 23:43:49 +0000
144@@ -0,0 +1,50 @@
145+<Project name="XChat" fileversion="2.0" language="C#" targetFramework="3.5" ctype="DotNetProject">
146+ <Configurations active="Debug">
147+ <Configuration name="Debug" ctype="DotNetProjectConfiguration">
148+ <Output directory="bin/Debug" assembly="XChat" />
149+ <Build debugmode="True" target="Library" />
150+ <Execution runwithwarnings="True" consolepause="False" runtime="MsNet" />
151+ <CodeGeneration compiler="Mcs" warninglevel="4" optimize="False" unsafecodeallowed="False" generateoverflowchecks="False" definesymbols="DEBUG" generatexmldocumentation="False" ctype="CSharpCompilerParameters" />
152+ </Configuration>
153+ <Configuration name="Release" ctype="DotNetProjectConfiguration">
154+ <Output directory="bin/Release" assembly="XChat" />
155+ <Build debugmode="False" target="Library" />
156+ <Execution runwithwarnings="True" consolepause="False" runtime="MsNet" />
157+ <CodeGeneration compiler="Mcs" warninglevel="4" optimize="False" unsafecodeallowed="False" generateoverflowchecks="False" generatexmldocumentation="False" ctype="CSharpCompilerParameters" />
158+ </Configuration>
159+ </Configurations>
160+ <Contents>
161+ <File name="AssemblyInfo.cs" subtype="Code" buildaction="Compile" />
162+ <File name="src" subtype="Directory" buildaction="Compile" />
163+ <File name="src/XChat.cs" subtype="Code" buildaction="Compile" />
164+ <File name="src/XChatConnectAction.cs" subtype="Code" buildaction="Compile" />
165+ <File name="src/XChatConnectionItem.cs" subtype="Code" buildaction="Compile" />
166+ <File name="src/XChatConnectionItemSource.cs" subtype="Code" buildaction="Compile" />
167+ <File name="src/XChatDisconnectAction.cs" subtype="Code" buildaction="Compile" />
168+ <File name="Resources" subtype="Directory" buildaction="Compile" />
169+ <File name="Resources/XChat.addin.xml" subtype="Code" buildaction="EmbedAsResource" />
170+ <File name="src/XChatChannelItem.cs" subtype="Code" buildaction="Compile" />
171+ <File name="src/XChatChannelItemSource.cs" subtype="Code" buildaction="Compile" />
172+ <File name="src/XChatMessageAction.cs" subtype="Code" buildaction="Compile" />
173+ <File name="src/XChatUserItem.cs" subtype="Code" buildaction="Compile" />
174+ </Contents>
175+ <References>
176+ <ProjectReference type="Gac" localcopy="True" refto="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
177+ <ProjectReference type="Gac" localcopy="True" refto="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
178+ <ProjectReference type="Assembly" localcopy="True" specificVersion="False" refto="../../../../../usr/local/lib/gnome-do/Do.Interface.Linux.AnimationBase.dll" />
179+ <ProjectReference type="Assembly" localcopy="True" specificVersion="False" refto="../../../../../usr/local/lib/gnome-do/Do.Interface.Linux.Classic.dll" />
180+ <ProjectReference type="Assembly" localcopy="True" specificVersion="False" refto="../../../../../usr/local/lib/gnome-do/Do.Interface.Linux.dll" />
181+ <ProjectReference type="Assembly" localcopy="True" specificVersion="False" refto="../../../../../usr/local/lib/gnome-do/Do.Interface.Linux.Docky.dll" />
182+ <ProjectReference type="Assembly" localcopy="True" specificVersion="False" refto="../../../../../usr/local/lib/gnome-do/Do.Interface.Linux.GlassFrame.dll" />
183+ <ProjectReference type="Assembly" localcopy="True" specificVersion="False" refto="../../../../../usr/local/lib/gnome-do/Do.Interface.Linux.HUD.dll" />
184+ <ProjectReference type="Assembly" localcopy="True" specificVersion="False" refto="../../../../../usr/local/lib/gnome-do/Do.Interface.Linux.Mini.dll" />
185+ <ProjectReference type="Assembly" localcopy="True" specificVersion="False" refto="../../../../../usr/local/lib/gnome-do/Do.Interface.Wink.dll" />
186+ <ProjectReference type="Assembly" localcopy="True" specificVersion="False" refto="../../../../../usr/local/lib/gnome-do/Do.Platform.dll" />
187+ <ProjectReference type="Assembly" localcopy="True" specificVersion="False" refto="../../../../../usr/local/lib/gnome-do/Do.Platform.Linux.dll" />
188+ <ProjectReference type="Assembly" localcopy="True" specificVersion="False" refto="../../../../../usr/local/lib/gnome-do/Do.Universe.dll" />
189+ <ProjectReference type="Gac" localcopy="True" refto="System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
190+ <ProjectReference type="Gac" localcopy="True" refto="NDesk.DBus.GLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f6716e4f9b2ed099" />
191+ <ProjectReference type="Gac" localcopy="True" refto="NDesk.DBus, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f6716e4f9b2ed099" />
192+ <ProjectReference type="Gac" localcopy="True" refto="Mono.Posix, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />
193+ </References>
194+</Project>
195\ No newline at end of file
196
197=== added directory 'XChat/src'
198=== added file 'XChat/src/XChat.cs'
199--- XChat/src/XChat.cs 1970-01-01 00:00:00 +0000
200+++ XChat/src/XChat.cs 2009-06-04 00:42:51 +0000
201@@ -0,0 +1,88 @@
202+// XChat.cs
203+//
204+// Copyright (C) 2009 Marco Peraza
205+//
206+// This program is free software: you can redistribute it and/or modify
207+// it under the terms of the GNU General Public License as published by
208+// the Free Software Foundation, either version 3 of the License, or
209+// (at your option) any later version.
210+//
211+// This program is distributed in the hope that it will be useful,
212+// but WITHOUT ANY WARRANTY; without even the implied warranty of
213+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
214+// GNU General Public License for more details.
215+//
216+// You should have received a copy of the GNU General Public License
217+// along with this program. If not, see <http://www.gnu.org/licenses/>.
218+//
219+
220+using System;
221+
222+using Do.Universe;
223+using Do.Platform;
224+using System.Collections.Generic;
225+
226+using NDesk.DBus;
227+using org.freedesktop.DBus;
228+
229+namespace XChatPlugin
230+{
231+
232+
233+ public class XChat
234+ {
235+ const string XChatObjectPath = "/org/xchat/Remote";
236+ const string XChatServiceBusName = "org.xchat.service";
237+
238+
239+ [Interface ("org.xchat.connection")]
240+ public interface IXChatConnection
241+ {
242+ string Connect(string filename, string name, string desc, string version);
243+ }
244+
245+ [Interface ("org.xchat.plugin")]
246+ public interface IXChatPlugin
247+ {
248+ int ListInt(uint id, string name);
249+ uint ListGet(string name);
250+ bool ListNext(uint id);
251+ string ListStr(uint id, string name);
252+ void Command(string command);
253+ uint FindContext(string server, string channel);
254+ bool SetContext(uint id);
255+ }
256+
257+ /*private static IEnumerable<int> ConnectedServers {
258+ get {
259+
260+ }
261+ }*/
262+
263+ private static IXChatConnection GetXChatConnection()
264+ {
265+ try {
266+ return Bus.Session.GetObject<IXChatConnection>
267+ (XChatServiceBusName, new ObjectPath (XChatObjectPath));
268+ } catch {
269+ return null;
270+ }
271+ }
272+
273+ public static IXChatPlugin GetXChatObject ()
274+ {
275+ try {
276+ string path = XChat.GetXChatConnection().Connect("xchat","Gnome-Do", "Integration With Gnome-Do", "0.1");
277+ return Bus.Session.GetObject<IXChatPlugin>
278+ (XChatServiceBusName, new ObjectPath (path));
279+ } catch {
280+ return null;
281+ }
282+ }
283+
284+ public XChat()
285+ {
286+
287+ }
288+ }
289+}
290\ No newline at end of file
291
292=== added file 'XChat/src/XChatChannelItem.cs'
293--- XChat/src/XChatChannelItem.cs 1970-01-01 00:00:00 +0000
294+++ XChat/src/XChatChannelItem.cs 2009-06-04 00:42:51 +0000
295@@ -0,0 +1,65 @@
296+// XChatChannelItem.cs
297+//
298+// Copyright (C) 2009 Marco Peraza
299+//
300+// This program is free software: you can redistribute it and/or modify
301+// it under the terms of the GNU General Public License as published by
302+// the Free Software Foundation, either version 3 of the License, or
303+// (at your option) any later version.
304+//
305+// This program is distributed in the hope that it will be useful,
306+// but WITHOUT ANY WARRANTY; without even the implied warranty of
307+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
308+// GNU General Public License for more details.
309+//
310+// You should have received a copy of the GNU General Public License
311+// along with this program. If not, see <http://www.gnu.org/licenses/>.
312+//
313+
314+using System;
315+using System.IO;
316+
317+using Do.Universe;
318+using Do.Platform;
319+
320+namespace XChatPlugin
321+{
322+
323+
324+ public class XChatChannelItem : Item
325+ {
326+
327+ public XChatChannelItem (string server, string channel)
328+ {
329+ this.name = channel;
330+ this.channel = channel;
331+ this.server = server;
332+ }
333+
334+ string channel;
335+
336+ public string Channel {
337+ get { return channel; }
338+ }
339+
340+ string server;
341+
342+ public string Server {
343+ get { return server; }
344+ }
345+
346+ string name;
347+
348+ public override string Name {
349+ get { return name; }
350+ }
351+
352+ public override string Description {
353+ get { return name + " on " + server; }
354+ }
355+
356+ public override string Icon {
357+ get { return "xchat"; }
358+ }
359+ }
360+}
361\ No newline at end of file
362
363=== added file 'XChat/src/XChatChannelItemSource.cs'
364--- XChat/src/XChatChannelItemSource.cs 1970-01-01 00:00:00 +0000
365+++ XChat/src/XChatChannelItemSource.cs 2009-06-04 00:42:51 +0000
366@@ -0,0 +1,109 @@
367+// XChatChannelItemSource.cs
368+//
369+// Copyright (C) 2009 Marco Peraza
370+//
371+// This program is free software: you can redistribute it and/or modify
372+// it under the terms of the GNU General Public License as published by
373+// the Free Software Foundation, either version 3 of the License, or
374+// (at your option) any later version.
375+//
376+// This program is distributed in the hope that it will be useful,
377+// but WITHOUT ANY WARRANTY; without even the implied warranty of
378+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
379+// GNU General Public License for more details.
380+//
381+// You should have received a copy of the GNU General Public License
382+// along with this program. If not, see <http://www.gnu.org/licenses/>.
383+//
384+
385+using System;
386+using System.Collections.Generic;
387+
388+using Do.Universe;
389+using Do.Platform;
390+
391+namespace XChatPlugin
392+{
393+
394+
395+ public class XChatChannelItemSource : ItemSource
396+ {
397+ List<Item> items;
398+ public XChatChannelItemSource()
399+ {
400+ items = new List<Item>();
401+ }
402+
403+
404+ public override string Name {
405+ get { return "XChat Channels"; }
406+ }
407+
408+ public override string Description {
409+ get { return "Available XChat Channels"; }
410+ }
411+
412+ public override string Icon {
413+ get { return "xchat"; }
414+ }
415+
416+ public override IEnumerable<Type> SupportedItemTypes {
417+ get { yield return typeof (XChatChannelItem); }
418+ }
419+
420+ public override IEnumerable<Item> Items {
421+ get { return items; }
422+ }
423+
424+ public override IEnumerable<Item> ChildrenOfItem (Item item)
425+ {
426+ if (item is XChatChannelItem)
427+ foreach(XChatUserItem user in UsersInChannel(item))
428+ yield return user;
429+ }
430+
431+ public List<Item> UsersInChannel(Item item)
432+ {
433+ List<Item> users = new List<Item>();
434+
435+ XChatChannelItem channel = item as XChatChannelItem;
436+
437+ XChat.IXChatPlugin xchat = XChat.GetXChatObject();
438+ if(xchat == null)
439+ return users;
440+
441+ xchat.SetContext(xchat.FindContext(channel.Server, channel.Channel));
442+ uint userList = xchat.ListGet("users");
443+ while(xchat.ListNext(userList))
444+ {
445+ string nick = xchat.ListStr(userList, "nick");
446+ users.Add(new XChatUserItem(nick, channel.Server, channel.Channel));
447+ }
448+
449+ return users;
450+ }
451+
452+ public override void UpdateItems()
453+ {
454+ items.Clear();
455+
456+ XChat.IXChatPlugin xchat = XChat.GetXChatObject();
457+ if(xchat == null)
458+ return;
459+ uint chanList = xchat.ListGet("channels");
460+ while(xchat.ListNext(chanList))
461+ {
462+
463+ string channel = xchat.ListStr(chanList, "channel");
464+ string server = xchat.ListStr(chanList, "server");
465+ if(channel.StartsWith("#"))
466+ {
467+ items.Add(new XChatChannelItem(server, channel));
468+ }
469+ }
470+
471+ }
472+
473+
474+ }
475+}
476\ No newline at end of file
477
478=== added file 'XChat/src/XChatConnectAction.cs'
479--- XChat/src/XChatConnectAction.cs 1970-01-01 00:00:00 +0000
480+++ XChat/src/XChatConnectAction.cs 2009-06-04 00:42:51 +0000
481@@ -0,0 +1,91 @@
482+// XChatConnectAction.cs
483+//
484+// Copyright (C) 2009 Marco Peraza
485+//
486+// This program is free software: you can redistribute it and/or modify
487+// it under the terms of the GNU General Public License as published by
488+// the Free Software Foundation, either version 3 of the License, or
489+// (at your option) any later version.
490+//
491+// This program is distributed in the hope that it will be useful,
492+// but WITHOUT ANY WARRANTY; without even the implied warranty of
493+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
494+// GNU General Public License for more details.
495+//
496+// You should have received a copy of the GNU General Public License
497+// along with this program. If not, see <http://www.gnu.org/licenses/>.
498+//
499+
500+using System;
501+using System.Linq;
502+using System.Collections.Generic;
503+
504+using Mono.Unix;
505+using System.Diagnostics;
506+using System.Threading;
507+
508+using Do.Universe;
509+using Do.Platform;
510+
511+namespace XChatPlugin
512+{
513+
514+
515+ public class XChatConnectAction : Act
516+ {
517+
518+ public override string Name {
519+ get { return "Connect to IRC"; }
520+ }
521+
522+ public override string Description {
523+ get { return "Connect to an IRC server."; }
524+ }
525+
526+ public override string Icon {
527+ get { return "xchat"; }
528+ }
529+
530+ public override IEnumerable<Type> SupportedItemTypes {
531+ get {
532+ return new Type[] {
533+ typeof (ITextItem)
534+ };
535+ }
536+ }
537+
538+ public override IEnumerable<Item> Perform (IEnumerable<Item> items, IEnumerable<Item> modItems)
539+ {
540+ Services.Application.RunOnThread ( () => { DoAction(items, modItems); });
541+ yield break;
542+ }
543+
544+ private void DoAction (IEnumerable<Item> items, IEnumerable<Item> modItems)
545+ {
546+ XChat.IXChatPlugin xchat;
547+ xchat = XChat.GetXChatObject();
548+ if(xchat == null) //Try to start up xchat if it isn't already started
549+ {
550+ string exec = "xchat";
551+ Process proc = new Process();
552+ proc.StartInfo.FileName = exec;
553+ proc.Start();
554+
555+ Thread.Sleep(2500); //TODO: Get rid of this.
556+
557+ xchat = XChat.GetXChatObject();
558+ }
559+
560+
561+ if(xchat == null) { //If xchat doesn't start up, give up
562+ return;
563+ }
564+
565+ ITextItem item = items.First () as ITextItem;
566+
567+
568+ xchat.Command("newserver " + item.Text);
569+ return;
570+ }
571+ }
572+}
573\ No newline at end of file
574
575=== added file 'XChat/src/XChatConnectionItem.cs'
576--- XChat/src/XChatConnectionItem.cs 1970-01-01 00:00:00 +0000
577+++ XChat/src/XChatConnectionItem.cs 2009-06-04 00:42:51 +0000
578@@ -0,0 +1,59 @@
579+// XChatConnectionItem.cs
580+//
581+// Copyright (C) 2009 Marco Peraza
582+//
583+// This program is free software: you can redistribute it and/or modify
584+// it under the terms of the GNU General Public License as published by
585+// the Free Software Foundation, either version 3 of the License, or
586+// (at your option) any later version.
587+//
588+// This program is distributed in the hope that it will be useful,
589+// but WITHOUT ANY WARRANTY; without even the implied warranty of
590+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
591+// GNU General Public License for more details.
592+//
593+// You should have received a copy of the GNU General Public License
594+// along with this program. If not, see <http://www.gnu.org/licenses/>.
595+//
596+
597+using System;
598+using System.IO;
599+
600+using Do.Universe;
601+using Do.Platform;
602+
603+namespace XChatPlugin
604+{
605+
606+
607+ public class XChatConnectionItem : Item
608+ {
609+
610+ public XChatConnectionItem (string name, string server)
611+ {
612+ this.name = name;
613+ this.server = server;
614+ }
615+
616+ string server;
617+
618+ public string Server {
619+ get { return server; }
620+ }
621+
622+
623+ string name;
624+
625+ public override string Name {
626+ get { return name; }
627+ }
628+
629+ public override string Description {
630+ get { return server; }
631+ }
632+
633+ public override string Icon {
634+ get { return "xchat"; }
635+ }
636+ }
637+}
638\ No newline at end of file
639
640=== added file 'XChat/src/XChatConnectionItemSource.cs'
641--- XChat/src/XChatConnectionItemSource.cs 1970-01-01 00:00:00 +0000
642+++ XChat/src/XChatConnectionItemSource.cs 2009-06-04 00:42:51 +0000
643@@ -0,0 +1,115 @@
644+// XChatConnectionItemSource.cs
645+//
646+// Copyright (C) 2009 Marco Peraza
647+//
648+// This program is free software: you can redistribute it and/or modify
649+// it under the terms of the GNU General Public License as published by
650+// the Free Software Foundation, either version 3 of the License, or
651+// (at your option) any later version.
652+//
653+// This program is distributed in the hope that it will be useful,
654+// but WITHOUT ANY WARRANTY; without even the implied warranty of
655+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
656+// GNU General Public License for more details.
657+//
658+// You should have received a copy of the GNU General Public License
659+// along with this program. If not, see <http://www.gnu.org/licenses/>.
660+//
661+
662+using System;
663+using System.Collections.Generic;
664+
665+using Do.Universe;
666+using Do.Platform;
667+
668+namespace XChatPlugin
669+{
670+
671+
672+ public class XChatConnectionItemSource : ItemSource
673+ {
674+ List<Item> items;
675+ List<string> servers;
676+ public XChatConnectionItemSource()
677+ {
678+ items = new List<Item>();
679+ servers = new List<string>();
680+ }
681+
682+
683+ public override string Name {
684+ get { return "XChat Connections"; }
685+ }
686+
687+ public override string Description {
688+ get { return "Available XChat Connections"; }
689+ }
690+
691+ public override string Icon {
692+ get { return "xchat"; }
693+ }
694+
695+ public override IEnumerable<Type> SupportedItemTypes {
696+ get { yield return typeof (XChatConnectionItem); }
697+ }
698+
699+ public override IEnumerable<Item> Items {
700+ get { return items; }
701+ }
702+
703+ public override IEnumerable<Item> ChildrenOfItem (Item item)
704+ {
705+ if (item is XChatConnectionItem)
706+ foreach(XChatChannelItem user in ChannelsInServer(item))
707+ yield return user;
708+ }
709+
710+ private IEnumerable<Item> ChannelsInServer (Item item)
711+ {
712+ List<Item> channels = new List<Item>();
713+
714+ string parentServer = (item as XChatConnectionItem).Server;
715+
716+ XChat.IXChatPlugin xchat = XChat.GetXChatObject();
717+ if(xchat == null)
718+ return channels;
719+ uint chanList = xchat.ListGet("channels");
720+ while(xchat.ListNext(chanList))
721+ {
722+
723+ string channel = xchat.ListStr(chanList, "channel");
724+ string server = xchat.ListStr(chanList, "server");
725+ if(channel.StartsWith("#") && server == parentServer)
726+ {
727+ channels.Add(new XChatChannelItem(server, channel));
728+ }
729+ }
730+ return channels;
731+ }
732+
733+ public override void UpdateItems()
734+ {
735+ items.Clear();
736+ servers.Clear();
737+
738+ XChat.IXChatPlugin xchat = XChat.GetXChatObject();
739+ if(xchat == null)
740+ return;
741+
742+ uint chanList = xchat.ListGet("channels");
743+ while(xchat.ListNext(chanList))
744+ {
745+ string server = xchat.ListStr(chanList, "server");
746+ string network = xchat.ListStr(chanList, "network");
747+ if(!servers.Contains(server))
748+ {
749+ servers.Add(server);
750+ items.Add(new XChatConnectionItem(network, server));
751+ }
752+ }
753+
754+ }
755+
756+
757+ }
758+}
759\ No newline at end of file
760
761=== added file 'XChat/src/XChatDisconnectAction.cs'
762--- XChat/src/XChatDisconnectAction.cs 1970-01-01 00:00:00 +0000
763+++ XChat/src/XChatDisconnectAction.cs 2009-06-04 00:42:51 +0000
764@@ -0,0 +1,68 @@
765+// XChatDisconnectAction.cs
766+//
767+// Copyright (C) 2009 Marco Peraza
768+//
769+// This program is free software: you can redistribute it and/or modify
770+// it under the terms of the GNU General Public License as published by
771+// the Free Software Foundation, either version 3 of the License, or
772+// (at your option) any later version.
773+//
774+// This program is distributed in the hope that it will be useful,
775+// but WITHOUT ANY WARRANTY; without even the implied warranty of
776+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
777+// GNU General Public License for more details.
778+//
779+// You should have received a copy of the GNU General Public License
780+// along with this program. If not, see <http://www.gnu.org/licenses/>.
781+//
782+
783+using System;
784+using System.Linq;
785+using System.Collections.Generic;
786+
787+using Mono.Unix;
788+
789+using Do.Universe;
790+using Do.Platform;
791+
792+namespace XChatPlugin
793+{
794+
795+
796+ public class XChatDisconnectAction : Act
797+ {
798+
799+ public override string Name {
800+ get { return "Disconnect from IRC"; }
801+ }
802+
803+ public override string Description {
804+ get { return "Disconnect from an IRC server."; }
805+ }
806+
807+ public override string Icon {
808+ get { return "xchat"; }
809+ }
810+
811+ public override IEnumerable<Type> SupportedItemTypes {
812+ get {
813+ return new Type[] {
814+ typeof (XChatConnectionItem)
815+ };
816+ }
817+ }
818+
819+ public override IEnumerable<Item> Perform (IEnumerable<Item> items, IEnumerable<Item> modItems)
820+ {
821+ XChat.IXChatPlugin xchat = XChat.GetXChatObject();
822+ if(xchat == null)
823+ yield break;
824+
825+ XChatConnectionItem item = items.First () as XChatConnectionItem;
826+ xchat.SetContext(xchat.FindContext(item.Server,""));
827+
828+ xchat.Command("discon");
829+ yield break;
830+ }
831+ }
832+}
833\ No newline at end of file
834
835=== added file 'XChat/src/XChatMessageAction.cs'
836--- XChat/src/XChatMessageAction.cs 1970-01-01 00:00:00 +0000
837+++ XChat/src/XChatMessageAction.cs 2009-06-04 00:42:51 +0000
838@@ -0,0 +1,94 @@
839+// XChatMessageAction.cs
840+//
841+// Copyright (C) 2009 Marco Peraza
842+//
843+// This program is free software: you can redistribute it and/or modify
844+// it under the terms of the GNU General Public License as published by
845+// the Free Software Foundation, either version 3 of the License, or
846+// (at your option) any later version.
847+//
848+// This program is distributed in the hope that it will be useful,
849+// but WITHOUT ANY WARRANTY; without even the implied warranty of
850+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
851+// GNU General Public License for more details.
852+//
853+// You should have received a copy of the GNU General Public License
854+// along with this program. If not, see <http://www.gnu.org/licenses/>.
855+//
856+
857+using System;
858+using System.Linq;
859+using System.Collections.Generic;
860+
861+using Mono.Unix;
862+
863+using Do.Universe;
864+using Do.Platform;
865+
866+namespace XChatPlugin
867+{
868+
869+
870+ public class XChatMessageAction : Act
871+ {
872+
873+ public override string Name {
874+ get { return "Send IRC Message"; }
875+ }
876+
877+ public override string Description {
878+ get { return "Send an IRC Message"; }
879+ }
880+
881+ public override string Icon {
882+ get { return "xchat"; }
883+ }
884+
885+ public override IEnumerable<Type> SupportedItemTypes {
886+ get {
887+ return new Type[] {
888+ typeof (XChatChannelItem),
889+ typeof (XChatUserItem)
890+ };
891+ }
892+ }
893+
894+ public override IEnumerable<Type> SupportedModifierItemTypes {
895+ get {
896+ return new Type[] {
897+ typeof (ITextItem)
898+ };
899+ }
900+ }
901+
902+ public override IEnumerable<Item> Perform (IEnumerable<Item> items, IEnumerable<Item> modItems)
903+ {
904+ XChat.IXChatPlugin xchat = XChat.GetXChatObject();
905+ if(xchat == null)
906+ yield break;
907+
908+ Item destinationItem = items.First ();
909+
910+ string destination;
911+ string server;
912+
913+ if(destinationItem is XChatChannelItem)
914+ {
915+ destination = (destinationItem as XChatChannelItem).Channel;
916+ server = (destinationItem as XChatChannelItem).Server;
917+ }
918+ else
919+ {
920+ destination = (destinationItem as XChatUserItem).Nick;
921+ server = (destinationItem as XChatUserItem).Server;
922+ }
923+
924+ ITextItem text = modItems.First () as ITextItem;
925+
926+ xchat.SetContext(xchat.FindContext(server, ""));
927+
928+ xchat.Command("msg " + destination + " " + text.Text);
929+ yield break;
930+ }
931+ }
932+}
933\ No newline at end of file
934
935=== added file 'XChat/src/XChatUserItem.cs'
936--- XChat/src/XChatUserItem.cs 1970-01-01 00:00:00 +0000
937+++ XChat/src/XChatUserItem.cs 2009-06-04 00:42:51 +0000
938@@ -0,0 +1,72 @@
939+// XChatUserItem.cs
940+//
941+// Copyright (C) 2009 Marco Peraza
942+//
943+// This program is free software: you can redistribute it and/or modify
944+// it under the terms of the GNU General Public License as published by
945+// the Free Software Foundation, either version 3 of the License, or
946+// (at your option) any later version.
947+//
948+// This program is distributed in the hope that it will be useful,
949+// but WITHOUT ANY WARRANTY; without even the implied warranty of
950+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
951+// GNU General Public License for more details.
952+//
953+// You should have received a copy of the GNU General Public License
954+// along with this program. If not, see <http://www.gnu.org/licenses/>.
955+//
956+
957+using System;
958+using System.IO;
959+
960+using Do.Universe;
961+using Do.Platform;
962+
963+namespace XChatPlugin
964+{
965+
966+
967+ public class XChatUserItem : Item
968+ {
969+
970+ public XChatUserItem (string nick, string server, string channel)
971+ {
972+ this.name = nick;
973+ this.nick = nick;
974+ this.channel = channel;
975+ this.server = server;
976+ }
977+
978+ string channel;
979+
980+ public string Channel {
981+ get { return channel; }
982+ }
983+
984+ string server;
985+
986+ public string Server {
987+ get { return server; }
988+ }
989+
990+ string nick;
991+
992+ public string Nick {
993+ get { return nick; }
994+ }
995+
996+ string name;
997+
998+ public override string Name {
999+ get { return name; }
1000+ }
1001+
1002+ public override string Description {
1003+ get { return name; }
1004+ }
1005+
1006+ public override string Icon {
1007+ get { return "xchat"; }
1008+ }
1009+ }
1010+}
1011\ No newline at end of file

Subscribers

People subscribed via source and target branches