Browse Source

Add license headers, twitter and quote commands

master
Chris Smith 14 years ago
parent
commit
547447992e
33 changed files with 685 additions and 64 deletions
  1. 3
    0
      .gitmodules
  2. 1
    0
      externals/twitter4j
  3. 74
    10
      nbproject/build-impl.xml
  4. 4
    4
      nbproject/genfiles.properties
  5. 2
    0
      nbproject/project.properties
  6. 1
    0
      nbproject/project.xml
  7. 19
    2
      src/com/md87/charliebravo/CharlieBravo.java
  8. 19
    2
      src/com/md87/charliebravo/Command.java
  9. 19
    2
      src/com/md87/charliebravo/CommandOptions.java
  10. 20
    2
      src/com/md87/charliebravo/Config.java
  11. 19
    2
      src/com/md87/charliebravo/ConfigCache.java
  12. 19
    2
      src/com/md87/charliebravo/Followup.java
  13. 24
    2
      src/com/md87/charliebravo/InputHandler.java
  14. 19
    2
      src/com/md87/charliebravo/Response.java
  15. 19
    2
      src/com/md87/charliebravo/commands/AuthenticateCommand.java
  16. 19
    2
      src/com/md87/charliebravo/commands/CalcCommand.java
  17. 19
    2
      src/com/md87/charliebravo/commands/DefineCommand.java
  18. 19
    2
      src/com/md87/charliebravo/commands/FollowupsCommand.java
  19. 19
    2
      src/com/md87/charliebravo/commands/GitCommand.java
  20. 19
    2
      src/com/md87/charliebravo/commands/GoogleCommand.java
  21. 19
    2
      src/com/md87/charliebravo/commands/HelpCommand.java
  22. 19
    2
      src/com/md87/charliebravo/commands/IssueCommand.java
  23. 19
    2
      src/com/md87/charliebravo/commands/LawCommand.java
  24. 19
    2
      src/com/md87/charliebravo/commands/NewzbinCommand.java
  25. 19
    2
      src/com/md87/charliebravo/commands/QuitCommand.java
  26. 69
    0
      src/com/md87/charliebravo/commands/QuoteCommand.java
  27. 19
    2
      src/com/md87/charliebravo/commands/ReloadCommand.java
  28. 19
    2
      src/com/md87/charliebravo/commands/SetCommand.java
  29. 19
    2
      src/com/md87/charliebravo/commands/SkillCommand.java
  30. 19
    2
      src/com/md87/charliebravo/commands/SnippetsCommand.java
  31. 19
    2
      src/com/md87/charliebravo/commands/TranslateCommand.java
  32. 50
    0
      src/com/md87/charliebravo/commands/TwitterCommand.java
  33. 19
    2
      src/com/md87/charliebravo/commands/WhoisCommand.java

+ 3
- 0
.gitmodules View File

10
 [submodule "externals/util"]
10
 [submodule "externals/util"]
11
 	path = externals/util
11
 	path = externals/util
12
 	url = ssh://renji/home/chris/git/util
12
 	url = ssh://renji/home/chris/git/util
13
+[submodule "externals/twitter4j"]
14
+	path = externals/twitter4j
15
+	url = git://github.com/yusuke/twitter4j.git

+ 1
- 0
externals/twitter4j

1
+Subproject commit b2daa7e011c26451ae4305bc9cc944513fdd1a73

+ 74
- 10
nbproject/build-impl.xml View File

20
 
20
 
21
         -->
21
         -->
22
 <project xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:jaxrpc="http://www.netbeans.org/ns/j2se-project/jax-rpc" basedir=".." default="default" name="charliebravo-impl">
22
 <project xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:jaxrpc="http://www.netbeans.org/ns/j2se-project/jax-rpc" basedir=".." default="default" name="charliebravo-impl">
23
+    <fail message="Please build using Ant 1.7.1 or higher.">
24
+        <condition>
25
+            <not>
26
+                <antversion atleast="1.7.1"/>
27
+            </not>
28
+        </condition>
29
+    </fail>
23
     <target depends="test,jar,javadoc" description="Build and test whole project." name="default"/>
30
     <target depends="test,jar,javadoc" description="Build and test whole project." name="default"/>
24
     <!-- 
31
     <!-- 
25
                 ======================
32
                 ======================
71
         <condition property="have.sources">
78
         <condition property="have.sources">
72
             <or>
79
             <or>
73
                 <available file="${src.src4.dir}"/>
80
                 <available file="${src.src4.dir}"/>
81
+                <available file="${src.java.dir}"/>
74
                 <available file="${src.src3.dir}"/>
82
                 <available file="${src.src3.dir}"/>
75
                 <available file="${src.src2.dir}"/>
83
                 <available file="${src.src2.dir}"/>
76
                 <available file="${src.src.dir}"/>
84
                 <available file="${src.src.dir}"/>
129
     </target>
137
     </target>
130
     <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init" name="-init-check">
138
     <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init" name="-init-check">
131
         <fail unless="src.src4.dir">Must set src.src4.dir</fail>
139
         <fail unless="src.src4.dir">Must set src.src4.dir</fail>
140
+        <fail unless="src.java.dir">Must set src.java.dir</fail>
132
         <fail unless="src.src3.dir">Must set src.src3.dir</fail>
141
         <fail unless="src.src3.dir">Must set src.src3.dir</fail>
133
         <fail unless="src.src2.dir">Must set src.src2.dir</fail>
142
         <fail unless="src.src2.dir">Must set src.src2.dir</fail>
134
         <fail unless="src.src.dir">Must set src.src.dir</fail>
143
         <fail unless="src.src.dir">Must set src.src.dir</fail>
154
     </target>
163
     </target>
155
     <target name="-init-macrodef-javac">
164
     <target name="-init-macrodef-javac">
156
         <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
165
         <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
157
-            <attribute default="${src.src4.dir}:${src.src3.dir}:${src.src2.dir}:${src.src.dir}:${src.dir}" name="srcdir"/>
166
+            <attribute default="${src.src4.dir}:${src.java.dir}:${src.src3.dir}:${src.src2.dir}:${src.src.dir}:${src.dir}" name="srcdir"/>
158
             <attribute default="${build.classes.dir}" name="destdir"/>
167
             <attribute default="${build.classes.dir}" name="destdir"/>
159
             <attribute default="${javac.classpath}" name="classpath"/>
168
             <attribute default="${javac.classpath}" name="classpath"/>
160
             <attribute default="${includes}" name="includes"/>
169
             <attribute default="${includes}" name="includes"/>
161
             <attribute default="${excludes}" name="excludes"/>
170
             <attribute default="${excludes}" name="excludes"/>
162
             <attribute default="${javac.debug}" name="debug"/>
171
             <attribute default="${javac.debug}" name="debug"/>
163
-            <attribute default="/does/not/exist" name="sourcepath"/>
172
+            <attribute default="${empty.dir}" name="sourcepath"/>
173
+            <attribute default="${empty.dir}" name="gensrcdir"/>
164
             <element name="customize" optional="true"/>
174
             <element name="customize" optional="true"/>
165
             <sequential>
175
             <sequential>
176
+                <property location="${build.dir}/empty" name="empty.dir"/>
177
+                <mkdir dir="${empty.dir}"/>
166
                 <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}">
178
                 <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}">
179
+                    <src>
180
+                        <dirset dir="@{gensrcdir}" erroronmissingdir="false">
181
+                            <include name="*"/>
182
+                        </dirset>
183
+                    </src>
167
                     <classpath>
184
                     <classpath>
168
                         <path path="@{classpath}"/>
185
                         <path path="@{classpath}"/>
169
                     </classpath>
186
                     </classpath>
173
             </sequential>
190
             </sequential>
174
         </macrodef>
191
         </macrodef>
175
         <macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3">
192
         <macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3">
176
-            <attribute default="${src.src4.dir}:${src.src3.dir}:${src.src2.dir}:${src.src.dir}:${src.dir}" name="srcdir"/>
193
+            <attribute default="${src.src4.dir}:${src.java.dir}:${src.src3.dir}:${src.src2.dir}:${src.src.dir}:${src.dir}" name="srcdir"/>
177
             <attribute default="${build.classes.dir}" name="destdir"/>
194
             <attribute default="${build.classes.dir}" name="destdir"/>
178
             <attribute default="${javac.classpath}" name="classpath"/>
195
             <attribute default="${javac.classpath}" name="classpath"/>
179
             <sequential>
196
             <sequential>
279
                 <java classname="@{classname}" dir="${work.dir}" fork="true">
296
                 <java classname="@{classname}" dir="${work.dir}" fork="true">
280
                     <jvmarg line="${debug-args-line}"/>
297
                     <jvmarg line="${debug-args-line}"/>
281
                     <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
298
                     <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
299
+                    <jvmarg value="-Dfile.encoding=${source.encoding}"/>
300
+                    <redirector errorencoding="${source.encoding}" inputencoding="${source.encoding}" outputencoding="${source.encoding}"/>
282
                     <jvmarg line="${run.jvmargs}"/>
301
                     <jvmarg line="${run.jvmargs}"/>
283
                     <classpath>
302
                     <classpath>
284
                         <path path="@{classpath}"/>
303
                         <path path="@{classpath}"/>
295
     <target name="-init-macrodef-java">
314
     <target name="-init-macrodef-java">
296
         <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
315
         <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
297
             <attribute default="${main.class}" name="classname"/>
316
             <attribute default="${main.class}" name="classname"/>
317
+            <attribute default="${run.classpath}" name="classpath"/>
298
             <element name="customize" optional="true"/>
318
             <element name="customize" optional="true"/>
299
             <sequential>
319
             <sequential>
300
                 <java classname="@{classname}" dir="${work.dir}" fork="true">
320
                 <java classname="@{classname}" dir="${work.dir}" fork="true">
321
+                    <jvmarg value="-Dfile.encoding=${source.encoding}"/>
322
+                    <redirector errorencoding="${source.encoding}" inputencoding="${source.encoding}" outputencoding="${source.encoding}"/>
301
                     <jvmarg line="${run.jvmargs}"/>
323
                     <jvmarg line="${run.jvmargs}"/>
302
                     <classpath>
324
                     <classpath>
303
-                        <path path="${run.classpath}"/>
325
+                        <path path="@{classpath}"/>
304
                     </classpath>
326
                     </classpath>
305
                     <syspropertyset>
327
                     <syspropertyset>
306
                         <propertyref prefix="run-sys-prop."/>
328
                         <propertyref prefix="run-sys-prop."/>
340
         <!-- You can override this target in the ../build.xml file. -->
362
         <!-- You can override this target in the ../build.xml file. -->
341
     </target>
363
     </target>
342
     <target if="do.depend.true" name="-compile-depend">
364
     <target if="do.depend.true" name="-compile-depend">
343
-        <j2seproject3:depend/>
365
+        <pathconvert property="build.generated.subdirs">
366
+            <dirset dir="${build.generated.sources.dir}" erroronmissingdir="false">
367
+                <include name="*"/>
368
+            </dirset>
369
+        </pathconvert>
370
+        <j2seproject3:depend srcdir="${src.src4.dir}:${src.java.dir}:${src.src3.dir}:${src.src2.dir}:${src.src.dir}:${src.dir}:${build.generated.subdirs}"/>
344
     </target>
371
     </target>
345
     <target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-compile-depend" if="have.sources" name="-do-compile">
372
     <target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-compile-depend" if="have.sources" name="-do-compile">
346
-        <j2seproject3:javac/>
373
+        <j2seproject3:javac gensrcdir="${build.generated.sources.dir}"/>
347
         <copy todir="${build.classes.dir}">
374
         <copy todir="${build.classes.dir}">
348
             <fileset dir="${src.src4.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
375
             <fileset dir="${src.src4.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
376
+            <fileset dir="${src.java.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
349
             <fileset dir="${src.src3.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
377
             <fileset dir="${src.src3.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
350
             <fileset dir="${src.src2.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
378
             <fileset dir="${src.src2.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
351
             <fileset dir="${src.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
379
             <fileset dir="${src.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
364
     <target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single">
392
     <target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single">
365
         <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
393
         <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
366
         <j2seproject3:force-recompile/>
394
         <j2seproject3:force-recompile/>
367
-        <j2seproject3:javac excludes="" includes="${javac.includes}" sourcepath="${src.src4.dir}:${src.src3.dir}:${src.src2.dir}:${src.src.dir}:${src.dir}"/>
395
+        <j2seproject3:javac excludes="" gensrcdir="${build.generated.sources.dir}" includes="${javac.includes}" sourcepath="${src.src4.dir}:${src.java.dir}:${src.src3.dir}:${src.src2.dir}:${src.src.dir}:${src.dir}"/>
368
     </target>
396
     </target>
369
     <target name="-post-compile-single">
397
     <target name="-post-compile-single">
370
         <!-- Empty placeholder for easier customization. -->
398
         <!-- Empty placeholder for easier customization. -->
430
         <property location="${dist.jar}" name="dist.jar.resolved"/>
458
         <property location="${dist.jar}" name="dist.jar.resolved"/>
431
         <echo>java -jar "${dist.jar.resolved}"</echo>
459
         <echo>java -jar "${dist.jar.resolved}"</echo>
432
     </target>
460
     </target>
461
+    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="libs.CopyLibs.classpath" name="-do-jar-with-libraries-without-manifest" unless="manifest.available+main.class">
462
+        <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
463
+        <pathconvert property="run.classpath.without.build.classes.dir">
464
+            <path path="${run.classpath}"/>
465
+            <map from="${build.classes.dir.resolved}" to=""/>
466
+        </pathconvert>
467
+        <pathconvert pathsep=" " property="jar.classpath">
468
+            <path path="${run.classpath.without.build.classes.dir}"/>
469
+            <chainedmapper>
470
+                <flattenmapper/>
471
+                <globmapper from="*" to="lib/*"/>
472
+            </chainedmapper>
473
+        </pathconvert>
474
+        <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
475
+        <copylibs compress="${jar.compress}" jarfile="${dist.jar}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
476
+            <fileset dir="${build.classes.dir}"/>
477
+        </copylibs>
478
+    </target>
433
     <target name="-post-jar">
479
     <target name="-post-jar">
434
         <!-- Empty placeholder for easier customization. -->
480
         <!-- Empty placeholder for easier customization. -->
435
         <!-- You can override this target in the ../build.xml file. -->
481
         <!-- You can override this target in the ../build.xml file. -->
436
     </target>
482
     </target>
437
-    <target depends="init,compile,-pre-jar,-do-jar-with-manifest,-do-jar-without-manifest,-do-jar-with-mainclass,-do-jar-with-libraries,-post-jar" description="Build JAR." name="jar"/>
483
+    <target depends="init,compile,-pre-jar,-do-jar-with-manifest,-do-jar-without-manifest,-do-jar-with-mainclass,-do-jar-with-libraries,-do-jar-with-libraries-without-manifest,-post-jar" description="Build JAR." name="jar"/>
438
     <!--
484
     <!--
439
                 =================
485
                 =================
440
                 EXECUTION SECTION
486
                 EXECUTION SECTION
454
         <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
500
         <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
455
         <j2seproject1:java classname="${run.class}"/>
501
         <j2seproject1:java classname="${run.class}"/>
456
     </target>
502
     </target>
503
+    <target depends="init,-do-not-recompile,compile-test-single" name="run-test-with-main">
504
+        <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
505
+        <j2seproject1:java classname="${run.class}" classpath="${run.test.classpath}"/>
506
+    </target>
457
     <!--
507
     <!--
458
                 =================
508
                 =================
459
                 DEBUGGING SECTION
509
                 DEBUGGING SECTION
462
     <target depends="init" if="netbeans.home" name="-debug-start-debugger">
512
     <target depends="init" if="netbeans.home" name="-debug-start-debugger">
463
         <j2seproject1:nbjpdastart name="${debug.class}"/>
513
         <j2seproject1:nbjpdastart name="${debug.class}"/>
464
     </target>
514
     </target>
515
+    <target depends="init" if="netbeans.home" name="-debug-start-debugger-main-test">
516
+        <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${debug.class}"/>
517
+    </target>
465
     <target depends="init,compile" name="-debug-start-debuggee">
518
     <target depends="init,compile" name="-debug-start-debuggee">
466
         <j2seproject3:debug>
519
         <j2seproject3:debug>
467
             <customize>
520
             <customize>
479
         <j2seproject3:debug classname="${debug.class}"/>
532
         <j2seproject3:debug classname="${debug.class}"/>
480
     </target>
533
     </target>
481
     <target depends="init,-do-not-recompile,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single"/>
534
     <target depends="init,-do-not-recompile,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single"/>
535
+    <target depends="init,compile-test-single" if="netbeans.home" name="-debug-start-debuggee-main-test">
536
+        <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
537
+        <j2seproject3:debug classname="${debug.class}" classpath="${debug.test.classpath}"/>
538
+    </target>
539
+    <target depends="init,-do-not-recompile,compile-test-single,-debug-start-debugger-main-test,-debug-start-debuggee-main-test" if="netbeans.home" name="debug-test-with-main"/>
482
     <target depends="init" name="-pre-debug-fix">
540
     <target depends="init" name="-pre-debug-fix">
483
         <fail unless="fix.includes">Must set fix.includes</fail>
541
         <fail unless="fix.includes">Must set fix.includes</fail>
484
         <property name="javac.includes" value="${fix.includes}.java"/>
542
         <property name="javac.includes" value="${fix.includes}.java"/>
501
             <fileset dir="${src.src4.dir}" excludes="${excludes}" includes="${includes}">
559
             <fileset dir="${src.src4.dir}" excludes="${excludes}" includes="${includes}">
502
                 <filename name="**/*.java"/>
560
                 <filename name="**/*.java"/>
503
             </fileset>
561
             </fileset>
562
+            <fileset dir="${src.java.dir}" excludes="${excludes}" includes="${includes}">
563
+                <filename name="**/*.java"/>
564
+            </fileset>
504
             <fileset dir="${src.src3.dir}" excludes="${excludes}" includes="${includes}">
565
             <fileset dir="${src.src3.dir}" excludes="${excludes}" includes="${includes}">
505
                 <filename name="**/*.java"/>
566
                 <filename name="**/*.java"/>
506
             </fileset>
567
             </fileset>
513
             <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
574
             <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
514
                 <filename name="**/*.java"/>
575
                 <filename name="**/*.java"/>
515
             </fileset>
576
             </fileset>
577
+            <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false">
578
+                <include name="**/*.java"/>
579
+            </fileset>
516
         </javadoc>
580
         </javadoc>
517
     </target>
581
     </target>
518
     <target depends="init,-javadoc-build" if="netbeans.home" name="-javadoc-browse" unless="no.javadoc.preview">
582
     <target depends="init,-javadoc-build" if="netbeans.home" name="-javadoc-browse" unless="no.javadoc.preview">
574
         <j2seproject3:junit testincludes="**/*Test.java"/>
638
         <j2seproject3:junit testincludes="**/*Test.java"/>
575
     </target>
639
     </target>
576
     <target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run">
640
     <target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run">
577
-        <fail if="tests.failed">Some tests failed; see details above.</fail>
641
+        <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
578
     </target>
642
     </target>
579
     <target depends="init" if="have.tests" name="test-report"/>
643
     <target depends="init" if="have.tests" name="test-report"/>
580
     <target depends="init" if="netbeans.home+have.tests" name="-test-browse"/>
644
     <target depends="init" if="netbeans.home+have.tests" name="-test-browse"/>
587
         <j2seproject3:junit excludes="" includes="${test.includes}"/>
651
         <j2seproject3:junit excludes="" includes="${test.includes}"/>
588
     </target>
652
     </target>
589
     <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single">
653
     <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single">
590
-        <fail if="tests.failed">Some tests failed; see details above.</fail>
654
+        <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
591
     </target>
655
     </target>
592
     <target depends="init,-do-not-recompile,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test." name="test-single"/>
656
     <target depends="init,-do-not-recompile,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test." name="test-single"/>
593
     <!--
657
     <!--

+ 4
- 4
nbproject/genfiles.properties View File

1
-build.xml.data.CRC32=aaeff047
1
+build.xml.data.CRC32=96efc3b9
2
 build.xml.script.CRC32=d4296ee3
2
 build.xml.script.CRC32=d4296ee3
3
 build.xml.stylesheet.CRC32=958a1d3e
3
 build.xml.stylesheet.CRC32=958a1d3e
4
 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
4
 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
5
 # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
5
 # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
6
-nbproject/build-impl.xml.data.CRC32=aaeff047
7
-nbproject/build-impl.xml.script.CRC32=9c9a087f
8
-nbproject/build-impl.xml.stylesheet.CRC32=65b8de21
6
+nbproject/build-impl.xml.data.CRC32=96efc3b9
7
+nbproject/build-impl.xml.script.CRC32=f57586c1
8
+nbproject/build-impl.xml.stylesheet.CRC32=5c621a33@1.26.1.45

+ 2
- 0
nbproject/project.properties View File

5
 # This directory is removed when the project is cleaned:
5
 # This directory is removed when the project is cleaned:
6
 build.dir=build
6
 build.dir=build
7
 build.generated.dir=${build.dir}/generated
7
 build.generated.dir=${build.dir}/generated
8
+build.generated.sources.dir=${build.dir}/generated-sources
8
 # Only compile against the classpath explicitly listed here:
9
 # Only compile against the classpath explicitly listed here:
9
 build.sysclasspath=ignore
10
 build.sysclasspath=ignore
10
 build.test.classes.dir=${build.dir}/test/classes
11
 build.test.classes.dir=${build.dir}/test/classes
74
     ${build.test.classes.dir}
75
     ${build.test.classes.dir}
75
 source.encoding=UTF-8
76
 source.encoding=UTF-8
76
 src.dir=src
77
 src.dir=src
78
+src.java.dir=externals/twitter4j/src/main/java
77
 src.src.dir=externals/dmdirc/src
79
 src.src.dir=externals/dmdirc/src
78
 src.src2.dir=externals/evetool/src
80
 src.src2.dir=externals/evetool/src
79
 src.src3.dir=externals/dmdirc-plugins/calc/src
81
 src.src3.dir=externals/dmdirc-plugins/calc/src

+ 1
- 0
nbproject/project.xml View File

7
             <minimum-ant-version>1.6.5</minimum-ant-version>
7
             <minimum-ant-version>1.6.5</minimum-ant-version>
8
             <source-roots>
8
             <source-roots>
9
                 <root id="src.src4.dir"/>
9
                 <root id="src.src4.dir"/>
10
+                <root id="src.java.dir"/>
10
                 <root id="src.src3.dir"/>
11
                 <root id="src.src3.dir"/>
11
                 <root id="src.src2.dir"/>
12
                 <root id="src.src2.dir"/>
12
                 <root id="src.src.dir"/>
13
                 <root id="src.src.dir"/>

+ 19
- 2
src/com/md87/charliebravo/CharlieBravo.java View File

1
 /*
1
 /*
2
- * To change this template, choose Tools | Templates
3
- * and open the template in the editor.
2
+ * Copyright (c) 2009-2010 Chris Smith
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
4
  */
21
  */
5
 
22
 
6
 package com.md87.charliebravo;
23
 package com.md87.charliebravo;

+ 19
- 2
src/com/md87/charliebravo/Command.java View File

1
 /*
1
 /*
2
- * To change this template, choose Tools | Templates
3
- * and open the template in the editor.
2
+ * Copyright (c) 2009-2010 Chris Smith
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
4
  */
21
  */
5
 
22
 
6
 package com.md87.charliebravo;
23
 package com.md87.charliebravo;

+ 19
- 2
src/com/md87/charliebravo/CommandOptions.java View File

1
 /*
1
 /*
2
- * To change this template, choose Tools | Templates
3
- * and open the template in the editor.
2
+ * Copyright (c) 2009-2010 Chris Smith
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
4
  */
21
  */
5
 
22
 
6
 package com.md87.charliebravo;
23
 package com.md87.charliebravo;

+ 20
- 2
src/com/md87/charliebravo/Config.java View File

1
 /*
1
 /*
2
- * To change this template, choose Tools | Templates
3
- * and open the template in the editor.
2
+ * Copyright (c) 2009-2010 Chris Smith
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
4
  */
21
  */
5
 
22
 
6
 package com.md87.charliebravo;
23
 package com.md87.charliebravo;
24
 
41
 
25
     private static final List<String> SETTINGS = Arrays.asList(new String[] {
42
     private static final List<String> SETTINGS = Arrays.asList(new String[] {
26
         "eve.apikey:String", "eve.userid:int", "eve.charid:int",
43
         "eve.apikey:String", "eve.userid:int", "eve.charid:int",
44
+        "twitter.username:String", "twitter.password:String",
27
         "admin.level:int",
45
         "admin.level:int",
28
         "internal.lastseen:int", "internal.lastuser:String"
46
         "internal.lastseen:int", "internal.lastuser:String"
29
     });
47
     });

+ 19
- 2
src/com/md87/charliebravo/ConfigCache.java View File

1
 /*
1
 /*
2
- * To change this template, choose Tools | Templates
3
- * and open the template in the editor.
2
+ * Copyright (c) 2009-2010 Chris Smith
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
4
  */
21
  */
5
 
22
 
6
 package com.md87.charliebravo;
23
 package com.md87.charliebravo;

+ 19
- 2
src/com/md87/charliebravo/Followup.java View File

1
 /*
1
 /*
2
- * To change this template, choose Tools | Templates
3
- * and open the template in the editor.
2
+ * Copyright (c) 2009-2010 Chris Smith
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
4
  */
21
  */
5
 
22
 
6
 package com.md87.charliebravo;
23
 package com.md87.charliebravo;

+ 24
- 2
src/com/md87/charliebravo/InputHandler.java View File

1
 /*
1
 /*
2
- * To change this template, choose Tools | Templates
3
- * and open the template in the editor.
2
+ * Copyright (c) 2009-2010 Chris Smith
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
4
  */
21
  */
5
 
22
 
6
 package com.md87.charliebravo;
23
 package com.md87.charliebravo;
29
 import com.md87.charliebravo.commands.SkillCommand;
46
 import com.md87.charliebravo.commands.SkillCommand;
30
 import com.md87.charliebravo.commands.SnippetsCommand;
47
 import com.md87.charliebravo.commands.SnippetsCommand;
31
 import com.md87.charliebravo.commands.LawCommand;
48
 import com.md87.charliebravo.commands.LawCommand;
49
+import com.md87.charliebravo.commands.QuoteCommand;
32
 import com.md87.charliebravo.commands.TranslateCommand;
50
 import com.md87.charliebravo.commands.TranslateCommand;
51
+import com.md87.charliebravo.commands.TwitterCommand;
33
 import com.md87.charliebravo.commands.WhoisCommand;
52
 import com.md87.charliebravo.commands.WhoisCommand;
34
 import com.md87.util.crypto.ArcFourEncrypter;
53
 import com.md87.util.crypto.ArcFourEncrypter;
35
 import java.util.ArrayList;
54
 import java.util.ArrayList;
74
         commands.add(new ReloadCommand());
93
         commands.add(new ReloadCommand());
75
         commands.add(new DefineCommand());
94
         commands.add(new DefineCommand());
76
         commands.add(new LawCommand());
95
         commands.add(new LawCommand());
96
+        commands.add(new QuoteCommand());
97
+        commands.add(new TwitterCommand());
77
     }
98
     }
78
 
99
 
79
     public Config getConfig() {
100
     public Config getConfig() {
283
                 }
304
                 }
284
             }
305
             }
285
         } catch (Throwable ex) {
306
         } catch (Throwable ex) {
307
+            ex.printStackTrace();
286
             response.sendMessage("an error has occured: " + ex.getMessage());
308
             response.sendMessage("an error has occured: " + ex.getMessage());
287
             response.addFollowup(new StacktraceFollowup(ex));
309
             response.addFollowup(new StacktraceFollowup(ex));
288
         }
310
         }

+ 19
- 2
src/com/md87/charliebravo/Response.java View File

1
 /*
1
 /*
2
- * To change this template, choose Tools | Templates
3
- * and open the template in the editor.
2
+ * Copyright (c) 2009-2010 Chris Smith
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
4
  */
21
  */
5
 
22
 
6
 package com.md87.charliebravo;
23
 package com.md87.charliebravo;

+ 19
- 2
src/com/md87/charliebravo/commands/AuthenticateCommand.java View File

1
 /*
1
 /*
2
- * To change this template, choose Tools | Templates
3
- * and open the template in the editor.
2
+ * Copyright (c) 2009-2010 Chris Smith
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
4
  */
21
  */
5
 
22
 
6
 package com.md87.charliebravo.commands;
23
 package com.md87.charliebravo.commands;

+ 19
- 2
src/com/md87/charliebravo/commands/CalcCommand.java View File

1
 /*
1
 /*
2
- * To change this template, choose Tools | Templates
3
- * and open the template in the editor.
2
+ * Copyright (c) 2009-2010 Chris Smith
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
4
  */
21
  */
5
 
22
 
6
 package com.md87.charliebravo.commands;
23
 package com.md87.charliebravo.commands;

+ 19
- 2
src/com/md87/charliebravo/commands/DefineCommand.java View File

1
 /*
1
 /*
2
- * To change this template, choose Tools | Templates
3
- * and open the template in the editor.
2
+ * Copyright (c) 2009-2010 Chris Smith
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
4
  */
21
  */
5
 
22
 
6
 package com.md87.charliebravo.commands;
23
 package com.md87.charliebravo.commands;

+ 19
- 2
src/com/md87/charliebravo/commands/FollowupsCommand.java View File

1
 /*
1
 /*
2
- * To change this template, choose Tools | Templates
3
- * and open the template in the editor.
2
+ * Copyright (c) 2009-2010 Chris Smith
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
4
  */
21
  */
5
 
22
 
6
 package com.md87.charliebravo.commands;
23
 package com.md87.charliebravo.commands;

+ 19
- 2
src/com/md87/charliebravo/commands/GitCommand.java View File

1
 /*
1
 /*
2
- * To change this template, choose Tools | Templates
3
- * and open the template in the editor.
2
+ * Copyright (c) 2009-2010 Chris Smith
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
4
  */
21
  */
5
 
22
 
6
 package com.md87.charliebravo.commands;
23
 package com.md87.charliebravo.commands;

+ 19
- 2
src/com/md87/charliebravo/commands/GoogleCommand.java View File

1
 /*
1
 /*
2
- * To change this template, choose Tools | Templates
3
- * and open the template in the editor.
2
+ * Copyright (c) 2009-2010 Chris Smith
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
4
  */
21
  */
5
 
22
 
6
 package com.md87.charliebravo.commands;
23
 package com.md87.charliebravo.commands;

+ 19
- 2
src/com/md87/charliebravo/commands/HelpCommand.java View File

1
 /*
1
 /*
2
- * To change this template, choose Tools | Templates
3
- * and open the template in the editor.
2
+ * Copyright (c) 2009-2010 Chris Smith
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
4
  */
21
  */
5
 
22
 
6
 package com.md87.charliebravo.commands;
23
 package com.md87.charliebravo.commands;

+ 19
- 2
src/com/md87/charliebravo/commands/IssueCommand.java View File

1
 /*
1
 /*
2
- * To change this template, choose Tools | Templates
3
- * and open the template in the editor.
2
+ * Copyright (c) 2009-2010 Chris Smith
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
4
  */
21
  */
5
 
22
 
6
 package com.md87.charliebravo.commands;
23
 package com.md87.charliebravo.commands;

+ 19
- 2
src/com/md87/charliebravo/commands/LawCommand.java View File

1
 /*
1
 /*
2
- * To change this template, choose Tools | Templates
3
- * and open the template in the editor.
2
+ * Copyright (c) 2009-2010 Chris Smith
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
4
  */
21
  */
5
 
22
 
6
 package com.md87.charliebravo.commands;
23
 package com.md87.charliebravo.commands;

+ 19
- 2
src/com/md87/charliebravo/commands/NewzbinCommand.java View File

1
 /*
1
 /*
2
- * To change this template, choose Tools | Templates
3
- * and open the template in the editor.
2
+ * Copyright (c) 2009-2010 Chris Smith
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
4
  */
21
  */
5
 
22
 
6
 package com.md87.charliebravo.commands;
23
 package com.md87.charliebravo.commands;

+ 19
- 2
src/com/md87/charliebravo/commands/QuitCommand.java View File

1
 /*
1
 /*
2
- * To change this template, choose Tools | Templates
3
- * and open the template in the editor.
2
+ * Copyright (c) 2009-2010 Chris Smith
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
4
  */
21
  */
5
 
22
 
6
 package com.md87.charliebravo.commands;
23
 package com.md87.charliebravo.commands;

+ 69
- 0
src/com/md87/charliebravo/commands/QuoteCommand.java View File

1
+/*
2
+ * Copyright (c) 2009-2010 Chris Smith
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21
+ */
22
+
23
+package com.md87.charliebravo.commands;
24
+
25
+import com.dmdirc.util.Downloader;
26
+import com.md87.charliebravo.Command;
27
+import com.md87.charliebravo.InputHandler;
28
+import com.md87.charliebravo.Response;
29
+
30
+import java.util.List;
31
+import java.util.regex.Matcher;
32
+import java.util.regex.Pattern;
33
+
34
+/**
35
+ *
36
+ * @author chris
37
+ */
38
+public class QuoteCommand implements Command {
39
+
40
+    protected static final String URL = "http://apps.md87.co.uk/quotes/rss?id=%s";
41
+
42
+    protected static final Pattern QUOTE_MATCHER = Pattern.compile(".*<description><![CDATA[(.*?)]]></description>.*");
43
+
44
+    public void execute(InputHandler handler, Response response, String line) throws Exception {
45
+        if (line.isEmpty()) {
46
+            response.sendMessage("You need to specify a quote number", true);
47
+        } else if (!line.matches("^[0-9]+$")) {
48
+            response.sendMessage("You need to specify a valid quote number", true);
49
+        } else {
50
+            final List<String> result = Downloader.getPage(String.format(URL, line));
51
+            final StringBuilder builder = new StringBuilder();
52
+
53
+            for (String rline : result) {
54
+                builder.append(rline);
55
+            }
56
+
57
+            final Matcher matcher = QUOTE_MATCHER.matcher(builder);
58
+
59
+            if (matcher.matches()) {
60
+                final String quote = matcher.group(1);
61
+                response.sendMessage("quote " + line + " is: " + quote);
62
+            } else {
63
+                response.sendMessage("There were no results for that quote", true);
64
+            }
65
+        }
66
+
67
+    }
68
+
69
+}

+ 19
- 2
src/com/md87/charliebravo/commands/ReloadCommand.java View File

1
 /*
1
 /*
2
- * To change this template, choose Tools | Templates
3
- * and open the template in the editor.
2
+ * Copyright (c) 2009-2010 Chris Smith
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
4
  */
21
  */
5
 
22
 
6
 package com.md87.charliebravo.commands;
23
 package com.md87.charliebravo.commands;

+ 19
- 2
src/com/md87/charliebravo/commands/SetCommand.java View File

1
 /*
1
 /*
2
- * To change this template, choose Tools | Templates
3
- * and open the template in the editor.
2
+ * Copyright (c) 2009-2010 Chris Smith
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
4
  */
21
  */
5
 
22
 
6
 package com.md87.charliebravo.commands;
23
 package com.md87.charliebravo.commands;

+ 19
- 2
src/com/md87/charliebravo/commands/SkillCommand.java View File

1
 /*
1
 /*
2
- * To change this template, choose Tools | Templates
3
- * and open the template in the editor.
2
+ * Copyright (c) 2009-2010 Chris Smith
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
4
  */
21
  */
5
 
22
 
6
 package com.md87.charliebravo.commands;
23
 package com.md87.charliebravo.commands;

+ 19
- 2
src/com/md87/charliebravo/commands/SnippetsCommand.java View File

1
 /*
1
 /*
2
- * To change this template, choose Tools | Templates
3
- * and open the template in the editor.
2
+ * Copyright (c) 2009-2010 Chris Smith
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
4
  */
21
  */
5
 
22
 
6
 package com.md87.charliebravo.commands;
23
 package com.md87.charliebravo.commands;

+ 19
- 2
src/com/md87/charliebravo/commands/TranslateCommand.java View File

1
 /*
1
 /*
2
- * To change this template, choose Tools | Templates
3
- * and open the template in the editor.
2
+ * Copyright (c) 2009-2010 Chris Smith
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
4
  */
21
  */
5
 
22
 
6
 package com.md87.charliebravo.commands;
23
 package com.md87.charliebravo.commands;

+ 50
- 0
src/com/md87/charliebravo/commands/TwitterCommand.java View File

1
+/*
2
+ * Copyright (c) 2009-2010 Chris Smith
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21
+ */
22
+
23
+package com.md87.charliebravo.commands;
24
+
25
+import com.md87.charliebravo.Command;
26
+import com.md87.charliebravo.CommandOptions;
27
+import com.md87.charliebravo.InputHandler;
28
+import com.md87.charliebravo.Response;
29
+import twitter4j.Twitter;
30
+
31
+/**
32
+ *
33
+ * @author chris
34
+ */
35
+@CommandOptions(requireAuthorisation=true, requiredSettings={"twitter.username","twitter.password"})
36
+public class TwitterCommand implements Command {
37
+
38
+    public void execute(InputHandler handler, Response response, String line) throws Exception {
39
+        final String openID = (String) handler.getParser().getClientInfoOrFake(response.getSource())
40
+                .getMap().get("OpenID");
41
+
42
+        String user = handler.getConfig().getOption(openID, "twitter.username");
43
+        String pass = handler.getConfig().getOption(openID, "twitter.password");
44
+
45
+        Twitter twitter = new Twitter(user, pass);
46
+        twitter.updateStatus(line);
47
+        response.sendMessage("Done", true);
48
+    }
49
+
50
+}

+ 19
- 2
src/com/md87/charliebravo/commands/WhoisCommand.java View File

1
 /*
1
 /*
2
- * To change this template, choose Tools | Templates
3
- * and open the template in the editor.
2
+ * Copyright (c) 2009-2010 Chris Smith
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
4
  */
21
  */
5
 
22
 
6
 package com.md87.charliebravo.commands;
23
 package com.md87.charliebravo.commands;

Loading…
Cancel
Save