Browse Source

This commit fixes issue 499

Hyperion/Dancer sucks.
OnJoin now asks for as many listmodes at a time as possible
Parser now keeps track of list modes requested and what order they were requested, so that listmode processor knows what each incomming listmode should be.
Misc fixes to support hyperion/dacer gayness with list modes.
parser.setAutoListMode() allows disabling automatic list mode requesting.
channel.hasAskedForListModes() returns true/false if channel.requestListModes() has ever been called.


git-svn-id: http://svn.dmdirc.com/trunk@2689 00569f92-eb28-0410-84fd-f71c24880f
tags/0.5.5
Shane Mc Cormack 16 years ago
parent
commit
1333a284e5

+ 253
- 172
nbproject/build-impl.xml View File

@@ -18,32 +18,35 @@ is divided into following sections:
18 18
   - applet
19 19
   - cleanup
20 20
 
21
--->
22
-<project name="DMDirc-impl" default="default" basedir=".." xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:j2seproject2="http://www.netbeans.org/ns/j2se-project/2" xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:jaxws="http://www.netbeans.org/ns/jax-ws/1">
23
-    <target name="default" depends="test,jar,javadoc" description="Build and test whole project."/>
21
+        -->
22
+<project xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject2="http://www.netbeans.org/ns/j2se-project/2" 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="DMDirc-impl">
23
+    <target depends="test,jar,javadoc" description="Build and test whole project." name="default"/>
24 24
     <!-- 
25
-    ======================
26
-    INITIALIZATION SECTION 
27
-    ======================
28
-    -->
25
+                ======================
26
+                INITIALIZATION SECTION 
27
+                ======================
28
+            -->
29 29
     <target name="-pre-init">
30 30
         <!-- Empty placeholder for easier customization. -->
31 31
         <!-- You can override this target in the ../build.xml file. -->
32 32
     </target>
33
-    <target name="-init-private" depends="-pre-init">
33
+    <target depends="-pre-init" name="-init-private">
34
+        <property file="nbproject/private/config.properties"/>
35
+        <property file="nbproject/private/configs/${config}.properties"/>
34 36
         <property file="nbproject/private/private.properties"/>
35 37
     </target>
36
-    <target name="-init-user" depends="-pre-init,-init-private">
38
+    <target depends="-pre-init,-init-private" name="-init-user">
37 39
         <property file="${user.properties.file}"/>
38 40
         <!-- The two properties below are usually overridden -->
39 41
         <!-- by the active platform. Just a fallback. -->
40 42
         <property name="default.javac.source" value="1.4"/>
41 43
         <property name="default.javac.target" value="1.4"/>
42 44
     </target>
43
-    <target name="-init-project" depends="-pre-init,-init-private,-init-user">
45
+    <target depends="-pre-init,-init-private,-init-user" name="-init-project">
46
+        <property file="nbproject/configs/${config}.properties"/>
44 47
         <property file="nbproject/project.properties"/>
45 48
     </target>
46
-    <target name="-do-init" depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property">
49
+    <target depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property" name="-do-init">
47 50
         <available file="${manifest.file}" property="manifest.available"/>
48 51
         <condition property="manifest.available+main.class">
49 52
             <and>
@@ -77,7 +80,10 @@ is divided into following sections:
77 80
             </and>
78 81
         </condition>
79 82
         <condition property="no.javadoc.preview">
80
-            <isfalse value="${javadoc.preview}"/>
83
+            <and>
84
+                <isset property="javadoc.preview"/>
85
+                <isfalse value="${javadoc.preview}"/>
86
+            </and>
81 87
         </condition>
82 88
         <property name="run.jvmargs" value=""/>
83 89
         <property name="javac.compilerargs" value=""/>
@@ -89,12 +95,29 @@ is divided into following sections:
89 95
         </condition>
90 96
         <property name="javac.debug" value="true"/>
91 97
         <property name="javadoc.preview" value="true"/>
98
+        <property name="application.args" value=""/>
99
+        <property name="source.encoding" value="${file.encoding}"/>
100
+        <condition property="javadoc.encoding.used" value="${javadoc.encoding}">
101
+            <and>
102
+                <isset property="javadoc.encoding"/>
103
+                <not>
104
+                    <equals arg1="${javadoc.encoding}" arg2=""/>
105
+                </not>
106
+            </and>
107
+        </condition>
108
+        <property name="javadoc.encoding.used" value="${source.encoding}"/>
109
+        <property name="includes" value="**"/>
110
+        <property name="excludes" value=""/>
111
+        <property name="do.depend" value="true"/>
112
+        <condition property="do.depend.true">
113
+            <istrue value="${do.depend}"/>
114
+        </condition>
92 115
     </target>
93 116
     <target name="-post-init">
94 117
         <!-- Empty placeholder for easier customization. -->
95 118
         <!-- You can override this target in the ../build.xml file. -->
96 119
     </target>
97
-    <target name="-init-check" depends="-pre-init,-init-private,-init-user,-init-project,-do-init">
120
+    <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init" name="-init-check">
98 121
         <fail unless="src.dir">Must set src.dir</fail>
99 122
         <fail unless="test.src.dir">Must set test.src.dir</fail>
100 123
         <fail unless="build.dir">Must set build.dir</fail>
@@ -117,36 +140,71 @@ is divided into following sections:
117 140
     </target>
118 141
     <target name="-init-macrodef-javac">
119 142
         <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
120
-            <attribute name="srcdir" default="${src.dir}"/>
121
-            <attribute name="destdir" default="${build.classes.dir}"/>
122
-            <attribute name="classpath" default="${javac.classpath}"/>
123
-            <attribute name="debug" default="${javac.debug}"/>
143
+            <attribute default="${src.dir}" name="srcdir"/>
144
+            <attribute default="${build.classes.dir}" name="destdir"/>
145
+            <attribute default="${javac.classpath}" name="classpath"/>
146
+            <attribute default="${includes}" name="includes"/>
147
+            <attribute default="${excludes}" name="excludes"/>
148
+            <attribute default="${javac.debug}" name="debug"/>
149
+            <attribute default="" name="javac.compilerargs.jaxws"/>
150
+            <attribute default="" name="sourcepath"/>
124 151
             <element name="customize" optional="true"/>
125 152
             <sequential>
126
-                <javac srcdir="@{srcdir}" destdir="@{destdir}" debug="@{debug}" deprecation="${javac.deprecation}" source="${javac.source}" target="${javac.target}" includeantruntime="false">
153
+                <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}">
127 154
                     <classpath>
128 155
                         <path path="@{classpath}"/>
129 156
                     </classpath>
130
-                    <compilerarg line="${javac.compilerargs}"/>
157
+                    <compilerarg line="${javac.compilerargs} @{javac.compilerargs.jaxws}"/>
131 158
                     <customize/>
132 159
                 </javac>
133 160
             </sequential>
134 161
         </macrodef>
162
+        <macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3">
163
+            <attribute default="${src.dir}" name="srcdir"/>
164
+            <attribute default="${build.classes.dir}" name="destdir"/>
165
+            <attribute default="${javac.classpath}" name="classpath"/>
166
+            <sequential>
167
+                <depend cache="${build.dir}/depcache" destdir="@{destdir}" excludes="${excludes}" includes="${includes}" srcdir="@{srcdir}">
168
+                    <classpath>
169
+                        <path path="@{classpath}"/>
170
+                    </classpath>
171
+                </depend>
172
+            </sequential>
173
+        </macrodef>
174
+        <macrodef name="force-recompile" uri="http://www.netbeans.org/ns/j2se-project/3">
175
+            <attribute default="${build.classes.dir}" name="destdir"/>
176
+            <sequential>
177
+                <fail unless="javac.includes">Must set javac.includes</fail>
178
+                <pathconvert pathsep="," property="javac.includes.binary">
179
+                    <path>
180
+                        <filelist dir="@{destdir}" files="${javac.includes}"/>
181
+                    </path>
182
+                    <globmapper from="*.java" to="*.class"/>
183
+                </pathconvert>
184
+                <delete>
185
+                    <files includes="${javac.includes.binary}"/>
186
+                </delete>
187
+            </sequential>
188
+        </macrodef>
135 189
     </target>
136 190
     <target name="-init-macrodef-junit">
137 191
         <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
138
-            <attribute name="includes" default="**/*Test.java"/>
192
+            <attribute default="${includes}" name="includes"/>
193
+            <attribute default="${excludes}" name="excludes"/>
194
+            <attribute default="**" name="testincludes"/>
139 195
             <sequential>
140
-                <junit showoutput="true" fork="true" dir="${basedir}" failureproperty="tests.failed" errorproperty="tests.failed">
196
+                <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true">
141 197
                     <batchtest todir="${build.test.results.dir}">
142
-                        <fileset dir="${test.src.dir}" includes="@{includes}"/>
198
+                        <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
199
+                            <filename name="@{testincludes}"/>
200
+                        </fileset>
143 201
                     </batchtest>
144 202
                     <classpath>
145 203
                         <path path="${run.test.classpath}"/>
146 204
                     </classpath>
147 205
                     <syspropertyset>
148 206
                         <propertyref prefix="test-sys-prop."/>
149
-                        <mapper type="glob" from="test-sys-prop.*" to="*"/>
207
+                        <mapper from="test-sys-prop.*" to="*" type="glob"/>
150 208
                     </syspropertyset>
151 209
                     <formatter type="brief" usefile="false"/>
152 210
                     <formatter type="xml"/>
@@ -157,11 +215,11 @@ is divided into following sections:
157 215
     </target>
158 216
     <target name="-init-macrodef-nbjpda">
159 217
         <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
160
-            <attribute name="name" default="${main.class}"/>
161
-            <attribute name="classpath" default="${debug.classpath}"/>
162
-            <attribute name="stopclassname" default=""/>
218
+            <attribute default="${main.class}" name="name"/>
219
+            <attribute default="${debug.classpath}" name="classpath"/>
220
+            <attribute default="" name="stopclassname"/>
163 221
             <sequential>
164
-                <nbjpdastart transport="dt_socket" addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}">
222
+                <nbjpdastart addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}" transport="dt_socket">
165 223
                     <classpath>
166 224
                         <path path="@{classpath}"/>
167 225
                     </classpath>
@@ -169,24 +227,36 @@ is divided into following sections:
169 227
             </sequential>
170 228
         </macrodef>
171 229
         <macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/j2se-project/1">
172
-            <attribute name="dir" default="${build.classes.dir}"/>
230
+            <attribute default="${build.classes.dir}" name="dir"/>
173 231
             <sequential>
174 232
                 <nbjpdareload>
175
-                    <fileset includes="${fix.includes}*.class" dir="@{dir}"/>
233
+                    <fileset dir="@{dir}" includes="${fix.includes}*.class"/>
176 234
                 </nbjpdareload>
177 235
             </sequential>
178 236
         </macrodef>
179 237
     </target>
180
-    <target name="-init-macrodef-debug">
238
+    <target name="-init-debug-args">
239
+        <property name="version-output" value="java version &quot;${ant.java.version}"/>
240
+        <condition property="have-jdk-older-than-1.4">
241
+            <or>
242
+                <contains string="${version-output}" substring="java version &quot;1.0"/>
243
+                <contains string="${version-output}" substring="java version &quot;1.1"/>
244
+                <contains string="${version-output}" substring="java version &quot;1.2"/>
245
+                <contains string="${version-output}" substring="java version &quot;1.3"/>
246
+            </or>
247
+        </condition>
248
+        <condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none">
249
+            <istrue value="${have-jdk-older-than-1.4}"/>
250
+        </condition>
251
+    </target>
252
+    <target depends="-init-debug-args" name="-init-macrodef-debug">
181 253
         <macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3">
182
-            <attribute name="classname" default="${main.class}"/>
183
-            <attribute name="classpath" default="${debug.classpath}"/>
254
+            <attribute default="${main.class}" name="classname"/>
255
+            <attribute default="${debug.classpath}" name="classpath"/>
184 256
             <element name="customize" optional="true"/>
185 257
             <sequential>
186
-                <java fork="true" classname="@{classname}" dir="${work.dir}">
187
-                    <jvmarg value="-Xdebug"/>
188
-                    <jvmarg value="-Xnoagent"/>
189
-                    <jvmarg value="-Djava.compiler=none"/>
258
+                <java classname="@{classname}" dir="${work.dir}" fork="true">
259
+                    <jvmarg line="${debug-args-line}"/>
190 260
                     <jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
191 261
                     <jvmarg line="${run.jvmargs}"/>
192 262
                     <classpath>
@@ -194,7 +264,7 @@ is divided into following sections:
194 264
                     </classpath>
195 265
                     <syspropertyset>
196 266
                         <propertyref prefix="run-sys-prop."/>
197
-                        <mapper type="glob" from="run-sys-prop.*" to="*"/>
267
+                        <mapper from="run-sys-prop.*" to="*" type="glob"/>
198 268
                     </syspropertyset>
199 269
                     <customize/>
200 270
                 </java>
@@ -203,17 +273,17 @@ is divided into following sections:
203 273
     </target>
204 274
     <target name="-init-macrodef-java">
205 275
         <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
206
-            <attribute name="classname" default="${main.class}"/>
276
+            <attribute default="${main.class}" name="classname"/>
207 277
             <element name="customize" optional="true"/>
208 278
             <sequential>
209
-                <java fork="true" classname="@{classname}" dir="${work.dir}">
279
+                <java classname="@{classname}" dir="${work.dir}" fork="true">
210 280
                     <jvmarg line="${run.jvmargs}"/>
211 281
                     <classpath>
212 282
                         <path path="${run.classpath}"/>
213 283
                     </classpath>
214 284
                     <syspropertyset>
215 285
                         <propertyref prefix="run-sys-prop."/>
216
-                        <mapper type="glob" from="run-sys-prop.*" to="*"/>
286
+                        <mapper from="run-sys-prop.*" to="*" type="glob"/>
217 287
                     </syspropertyset>
218 288
                     <customize/>
219 289
                 </java>
@@ -222,102 +292,102 @@ is divided into following sections:
222 292
     </target>
223 293
     <target name="-init-presetdef-jar">
224 294
         <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1">
225
-            <jar jarfile="${dist.jar}" compress="${jar.compress}">
295
+            <jar compress="${jar.compress}" jarfile="${dist.jar}">
226 296
                 <j2seproject1:fileset dir="${build.classes.dir}"/>
227 297
             </jar>
228 298
         </presetdef>
229 299
     </target>
230
-    <target name="init" depends="-pre-init,-init-private,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-junit,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar"/>
300
+    <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-junit,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar" name="init"/>
231 301
     <!--
232
-    ===================
233
-    COMPILATION SECTION
234
-    ===================
235
-    -->
236
-    <target name="deps-jar" depends="init" unless="no.deps"/>
237
-    <target name="-pre-pre-compile" depends="init,deps-jar">
302
+                ===================
303
+                COMPILATION SECTION
304
+                ===================
305
+            -->
306
+    <target depends="init" name="deps-jar" unless="no.deps"/>
307
+    <target depends="init,deps-jar" name="-pre-pre-compile">
238 308
         <mkdir dir="${build.classes.dir}"/>
239 309
     </target>
240 310
     <target name="-pre-compile">
241 311
         <!-- Empty placeholder for easier customization. -->
242 312
         <!-- You can override this target in the ../build.xml file. -->
243 313
     </target>
244
-    <target name="-do-compile" depends="init,deps-jar,-pre-pre-compile,-pre-compile" if="have.sources">
314
+    <target if="do.depend.true" name="-compile-depend">
315
+        <j2seproject3:depend/>
316
+    </target>
317
+    <target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-compile-depend" if="have.sources" name="-do-compile">
245 318
         <j2seproject3:javac/>
246 319
         <copy todir="${build.classes.dir}">
247
-            <fileset dir="${src.dir}" excludes="${build.classes.excludes}"/>
320
+            <fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
248 321
         </copy>
249 322
     </target>
250 323
     <target name="-post-compile">
251 324
         <!-- Empty placeholder for easier customization. -->
252 325
         <!-- You can override this target in the ../build.xml file. -->
253 326
     </target>
254
-    <target name="compile" depends="init,deps-jar,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project."/>
327
+    <target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/>
255 328
     <target name="-pre-compile-single">
256 329
         <!-- Empty placeholder for easier customization. -->
257 330
         <!-- You can override this target in the ../build.xml file. -->
258 331
     </target>
259
-    <target name="-do-compile-single" depends="init,deps-jar,-pre-pre-compile">
332
+    <target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single">
260 333
         <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
261
-        <j2seproject3:javac>
262
-            <customize>
263
-                <patternset includes="${javac.includes}"/>
264
-            </customize>
265
-        </j2seproject3:javac>
334
+        <j2seproject3:force-recompile/>
335
+        <j2seproject3:javac excludes="" includes="${javac.includes}" sourcepath="${src.dir}"/>
266 336
     </target>
267 337
     <target name="-post-compile-single">
268 338
         <!-- Empty placeholder for easier customization. -->
269 339
         <!-- You can override this target in the ../build.xml file. -->
270 340
     </target>
271
-    <target name="compile-single" depends="init,deps-jar,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single"/>
341
+    <target depends="init,deps-jar,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/>
272 342
     <!--
273
-    ====================
274
-    JAR BUILDING SECTION
275
-    ====================
276
-    -->
277
-    <target name="-pre-pre-jar" depends="init">
278
-        <dirname property="dist.jar.dir" file="${dist.jar}"/>
343
+                ====================
344
+                JAR BUILDING SECTION
345
+                ====================
346
+            -->
347
+    <target depends="init" name="-pre-pre-jar">
348
+        <dirname file="${dist.jar}" property="dist.jar.dir"/>
279 349
         <mkdir dir="${dist.jar.dir}"/>
280 350
     </target>
281 351
     <target name="-pre-jar">
282 352
         <!-- Empty placeholder for easier customization. -->
283 353
         <!-- You can override this target in the ../build.xml file. -->
284 354
     </target>
285
-    <target name="-do-jar-without-manifest" depends="init,compile,-pre-pre-jar,-pre-jar" unless="manifest.available">
355
+    <target depends="init,compile,-pre-pre-jar,-pre-jar" name="-do-jar-without-manifest" unless="manifest.available">
286 356
         <j2seproject1:jar/>
287 357
     </target>
288
-    <target name="-do-jar-with-manifest" depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available" unless="manifest.available+main.class">
358
+    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available" name="-do-jar-with-manifest" unless="manifest.available+main.class">
289 359
         <j2seproject1:jar manifest="${manifest.file}"/>
290 360
     </target>
291
-    <target name="-do-jar-with-mainclass" depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class" unless="manifest.available+main.class+mkdist.available">
361
+    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class" name="-do-jar-with-mainclass" unless="manifest.available+main.class+mkdist.available">
292 362
         <j2seproject1:jar manifest="${manifest.file}">
293 363
             <j2seproject1:manifest>
294 364
                 <j2seproject1:attribute name="Main-Class" value="${main.class}"/>
295 365
             </j2seproject1:manifest>
296 366
         </j2seproject1:jar>
297 367
         <echo>To run this application from the command line without Ant, try:</echo>
298
-        <property name="build.classes.dir.resolved" location="${build.classes.dir}"/>
299
-        <property name="dist.jar.resolved" location="${dist.jar}"/>
368
+        <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
369
+        <property location="${dist.jar}" name="dist.jar.resolved"/>
300 370
         <pathconvert property="run.classpath.with.dist.jar">
301 371
             <path path="${run.classpath}"/>
302 372
             <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/>
303 373
         </pathconvert>
304 374
         <echo>java -cp "${run.classpath.with.dist.jar}" ${main.class}</echo>
305 375
     </target>
306
-    <target name="-do-jar-with-libraries" depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class+mkdist.available">
307
-        <property name="build.classes.dir.resolved" location="${build.classes.dir}"/>
376
+    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class+mkdist.available" name="-do-jar-with-libraries">
377
+        <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
308 378
         <pathconvert property="run.classpath.without.build.classes.dir">
309 379
             <path path="${run.classpath}"/>
310 380
             <map from="${build.classes.dir.resolved}" to=""/>
311 381
         </pathconvert>
312
-        <pathconvert property="jar.classpath" pathsep=" ">
382
+        <pathconvert pathsep=" " property="jar.classpath">
313 383
             <path path="${run.classpath.without.build.classes.dir}"/>
314 384
             <chainedmapper>
315 385
                 <flattenmapper/>
316 386
                 <globmapper from="*" to="lib/*"/>
317 387
             </chainedmapper>
318 388
         </pathconvert>
319
-        <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" name="copylibs" classpath="${libs.CopyLibs.classpath}"/>
320
-        <copylibs manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}" jarfile="${dist.jar}" compress="${jar.compress}">
389
+        <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
390
+        <copylibs compress="${jar.compress}" jarfile="${dist.jar}" manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
321 391
             <fileset dir="${build.classes.dir}"/>
322 392
             <manifest>
323 393
                 <attribute name="Main-Class" value="${main.class}"/>
@@ -325,183 +395,194 @@ is divided into following sections:
325 395
             </manifest>
326 396
         </copylibs>
327 397
         <echo>To run this application from the command line without Ant, try:</echo>
328
-        <property name="dist.jar.resolved" location="${dist.jar}"/>
398
+        <property location="${dist.jar}" name="dist.jar.resolved"/>
329 399
         <echo>java -jar "${dist.jar.resolved}"</echo>
330 400
     </target>
331 401
     <target name="-post-jar">
332 402
         <!-- Empty placeholder for easier customization. -->
333 403
         <!-- You can override this target in the ../build.xml file. -->
334 404
     </target>
335
-    <target name="jar" 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."/>
405
+    <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"/>
336 406
     <!--
337
-    =================
338
-    EXECUTION SECTION
339
-    =================
340
-    -->
341
-    <target name="run" depends="init,compile" description="Run a main class.">
407
+                =================
408
+                EXECUTION SECTION
409
+                =================
410
+            -->
411
+    <target depends="init,compile" description="Run a main class." name="run">
342 412
         <j2seproject1:java>
343 413
             <customize>
344 414
                 <arg line="${application.args}"/>
345 415
             </customize>
346 416
         </j2seproject1:java>
347 417
     </target>
348
-    <target name="run-single" depends="init,compile-single">
418
+    <target name="-do-not-recompile">
419
+        <property name="javac.includes.binary" value=""/>
420
+    </target>
421
+    <target depends="init,-do-not-recompile,compile-single" name="run-single">
349 422
         <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
350 423
         <j2seproject1:java classname="${run.class}"/>
351 424
     </target>
352 425
     <!--
353
-    =================
354
-    DEBUGGING SECTION
355
-    =================
356
-    -->
357
-    <target name="-debug-start-debugger" if="netbeans.home" depends="init">
426
+                =================
427
+                DEBUGGING SECTION
428
+                =================
429
+            -->
430
+    <target depends="init" if="netbeans.home" name="-debug-start-debugger">
358 431
         <j2seproject1:nbjpdastart name="${debug.class}"/>
359 432
     </target>
360
-    <target name="-debug-start-debuggee" depends="init,compile">
433
+    <target depends="init,compile" name="-debug-start-debuggee">
361 434
         <j2seproject3:debug>
362 435
             <customize>
363 436
                 <arg line="${application.args}"/>
364 437
             </customize>
365 438
         </j2seproject3:debug>
366 439
     </target>
367
-    <target name="debug" if="netbeans.home" depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE."/>
368
-    <target name="-debug-start-debugger-stepinto" if="netbeans.home" depends="init">
440
+    <target depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE." if="netbeans.home" name="debug"/>
441
+    <target depends="init" if="netbeans.home" name="-debug-start-debugger-stepinto">
369 442
         <j2seproject1:nbjpdastart stopclassname="${main.class}"/>
370 443
     </target>
371
-    <target name="debug-stepinto" if="netbeans.home" depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee"/>
372
-    <target name="-debug-start-debuggee-single" if="netbeans.home" depends="init,compile-single">
444
+    <target depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee" if="netbeans.home" name="debug-stepinto"/>
445
+    <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-single">
373 446
         <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
374 447
         <j2seproject3:debug classname="${debug.class}"/>
375 448
     </target>
376
-    <target name="debug-single" if="netbeans.home" depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-single"/>
377
-    <target name="-pre-debug-fix" depends="init">
449
+    <target depends="init,-do-not-recompile,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single"/>
450
+    <target depends="init" name="-pre-debug-fix">
378 451
         <fail unless="fix.includes">Must set fix.includes</fail>
379 452
         <property name="javac.includes" value="${fix.includes}.java"/>
380 453
     </target>
381
-    <target name="-do-debug-fix" if="netbeans.home" depends="init,-pre-debug-fix,compile-single">
454
+    <target depends="init,-pre-debug-fix,compile-single" if="netbeans.home" name="-do-debug-fix">
382 455
         <j2seproject1:nbjpdareload/>
383 456
     </target>
384
-    <target name="debug-fix" if="netbeans.home" depends="init,-pre-debug-fix,-do-debug-fix"/>
457
+    <target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/>
385 458
     <!--
386
-    ===============
387
-    JAVADOC SECTION
388
-    ===============
389
-    -->
390
-    <target name="-javadoc-build" depends="init">
459
+                ===============
460
+                JAVADOC SECTION
461
+                ===============
462
+            -->
463
+    <target depends="init" name="-javadoc-build">
391 464
         <mkdir dir="${dist.javadoc.dir}"/>
392
-        <javadoc destdir="${dist.javadoc.dir}" source="${javac.source}" notree="${javadoc.notree}" use="${javadoc.use}" nonavbar="${javadoc.nonavbar}" noindex="${javadoc.noindex}" splitindex="${javadoc.splitindex}" author="${javadoc.author}" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}" private="${javadoc.private}" additionalparam="${javadoc.additionalparam}" failonerror="true" useexternalfile="true">
465
+        <javadoc additionalparam="${javadoc.additionalparam}" author="${javadoc.author}" charset="${javadoc.encoding.used}" destdir="${dist.javadoc.dir}" docencoding="${javadoc.encoding.used}" encoding="${javadoc.encoding.used}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}">
393 466
             <classpath>
394 467
                 <path path="${javac.classpath}"/>
395 468
             </classpath>
396
-            <sourcepath>
397
-                <pathelement location="${src.dir}"/>
398
-            </sourcepath>
399
-            <packageset dir="${src.dir}" includes="*/**"/>
400
-            <fileset dir="${src.dir}" includes="*.java"/>
469
+            <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
470
+                <filename name="**/*.java"/>
471
+            </fileset>
401 472
         </javadoc>
402 473
     </target>
403
-    <target name="-javadoc-browse" if="netbeans.home" unless="no.javadoc.preview" depends="init,-javadoc-build">
474
+    <target depends="init,-javadoc-build" if="netbeans.home" name="-javadoc-browse" unless="no.javadoc.preview">
404 475
         <nbbrowse file="${dist.javadoc.dir}/index.html"/>
405 476
     </target>
406
-    <target name="javadoc" depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc."/>
477
+    <target depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc." name="javadoc"/>
407 478
     <!--
408
-    =========================
409
-    JUNIT COMPILATION SECTION
410
-    =========================
411
-    -->
412
-    <target name="-pre-pre-compile-test" if="have.tests" depends="init,compile">
479
+                =========================
480
+                JUNIT COMPILATION SECTION
481
+                =========================
482
+            -->
483
+    <target depends="init,compile" if="have.tests" name="-pre-pre-compile-test">
413 484
         <mkdir dir="${build.test.classes.dir}"/>
414 485
     </target>
415 486
     <target name="-pre-compile-test">
416 487
         <!-- Empty placeholder for easier customization. -->
417 488
         <!-- You can override this target in the ../build.xml file. -->
418 489
     </target>
419
-    <target name="-do-compile-test" if="have.tests" depends="init,compile,-pre-pre-compile-test,-pre-compile-test">
420
-        <j2seproject3:javac srcdir="${test.src.dir}" destdir="${build.test.classes.dir}" debug="true" classpath="${javac.test.classpath}"/>
490
+    <target if="do.depend.true" name="-compile-test-depend">
491
+        <j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
492
+    </target>
493
+    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test">
494
+        <j2seproject3:javac classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
421 495
         <copy todir="${build.test.classes.dir}">
422
-            <fileset dir="${test.src.dir}" excludes="**/*.java"/>
496
+            <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
423 497
         </copy>
424 498
     </target>
425 499
     <target name="-post-compile-test">
426 500
         <!-- Empty placeholder for easier customization. -->
427 501
         <!-- You can override this target in the ../build.xml file. -->
428 502
     </target>
429
-    <target name="compile-test" depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test"/>
503
+    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test" name="compile-test"/>
430 504
     <target name="-pre-compile-test-single">
431 505
         <!-- Empty placeholder for easier customization. -->
432 506
         <!-- You can override this target in the ../build.xml file. -->
433 507
     </target>
434
-    <target name="-do-compile-test-single" if="have.tests" depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single">
508
+    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single">
435 509
         <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
436
-        <j2seproject3:javac srcdir="${test.src.dir}" destdir="${build.test.classes.dir}" debug="true" classpath="${javac.test.classpath}">
437
-            <customize>
438
-                <patternset includes="${javac.includes}"/>
439
-            </customize>
440
-        </j2seproject3:javac>
510
+        <j2seproject3:force-recompile destdir="${build.test.classes.dir}"/>
511
+        <j2seproject3:javac classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" excludes="" includes="${javac.includes}" sourcepath="${test.src.dir}" srcdir="${test.src.dir}"/>
441 512
         <copy todir="${build.test.classes.dir}">
442
-            <fileset dir="${test.src.dir}" excludes="**/*.java"/>
513
+            <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
443 514
         </copy>
444 515
     </target>
445 516
     <target name="-post-compile-test-single">
446 517
         <!-- Empty placeholder for easier customization. -->
447 518
         <!-- You can override this target in the ../build.xml file. -->
448 519
     </target>
449
-    <target name="compile-test-single" depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single"/>
520
+    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/>
450 521
     <!--
451
-    =======================
452
-    JUNIT EXECUTION SECTION
453
-    =======================
454
-    -->
455
-    <target name="-pre-test-run" if="have.tests" depends="init">
522
+                =======================
523
+                JUNIT EXECUTION SECTION
524
+                =======================
525
+            -->
526
+    <target depends="init" if="have.tests" name="-pre-test-run">
456 527
         <mkdir dir="${build.test.results.dir}"/>
457 528
     </target>
458
-    <target name="-do-test-run" if="have.tests" depends="init,compile-test,-pre-test-run">
459
-        <j2seproject3:junit/>
529
+    <target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run">
530
+        <j2seproject3:junit testincludes="**/*Test.java"/>
460 531
     </target>
461
-    <target name="-post-test-run" if="have.tests" depends="init,compile-test,-pre-test-run,-do-test-run">
532
+    <target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run">
462 533
         <fail if="tests.failed">Some tests failed; see details above.</fail>
463 534
     </target>
464
-    <target name="test-report" if="have.tests" depends="init"/>
465
-    <target name="-test-browse" if="netbeans.home+have.tests" depends="init"/>
466
-    <target name="test" depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests."/>
467
-    <target name="-pre-test-run-single" if="have.tests" depends="init">
535
+    <target depends="init" if="have.tests" name="test-report"/>
536
+    <target depends="init" if="netbeans.home+have.tests" name="-test-browse"/>
537
+    <target depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests." name="test"/>
538
+    <target depends="init" if="have.tests" name="-pre-test-run-single">
468 539
         <mkdir dir="${build.test.results.dir}"/>
469 540
     </target>
470
-    <target name="-do-test-run-single" if="have.tests" depends="init,compile-test-single,-pre-test-run-single">
541
+    <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single">
471 542
         <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
472
-        <j2seproject3:junit includes="${test.includes}"/>
543
+        <j2seproject3:junit excludes="" includes="${test.includes}"/>
473 544
     </target>
474
-    <target name="-post-test-run-single" if="have.tests" depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single">
545
+    <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single">
475 546
         <fail if="tests.failed">Some tests failed; see details above.</fail>
476 547
     </target>
477
-    <target name="test-single" depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test."/>
548
+    <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"/>
478 549
     <!--
479
-    =======================
480
-    JUNIT DEBUGGING SECTION
481
-    =======================
482
-    -->
483
-    <target name="-debug-start-debuggee-test" if="have.tests" depends="init,compile-test">
550
+                =======================
551
+                JUNIT DEBUGGING SECTION
552
+                =======================
553
+            -->
554
+    <target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test">
484 555
         <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
485
-        <j2seproject3:debug classname="junit.textui.TestRunner" classpath="${debug.test.classpath}">
556
+        <property location="${build.test.results.dir}/TEST-${test.class}.xml" name="test.report.file"/>
557
+        <delete file="${test.report.file}"/>
558
+        <mkdir dir="${build.test.results.dir}"/>
559
+        <j2seproject3:debug classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner" classpath="${ant.home}/lib/ant.jar:${ant.home}/lib/ant-junit.jar:${debug.test.classpath}">
486 560
             <customize>
487
-                <arg line="${test.class}"/>
561
+                <syspropertyset>
562
+                    <propertyref prefix="test-sys-prop."/>
563
+                    <mapper from="test-sys-prop.*" to="*" type="glob"/>
564
+                </syspropertyset>
565
+                <arg value="${test.class}"/>
566
+                <arg value="showoutput=true"/>
567
+                <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/>
568
+                <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.report.file}"/>
488 569
             </customize>
489 570
         </j2seproject3:debug>
490 571
     </target>
491
-    <target name="-debug-start-debugger-test" if="netbeans.home+have.tests" depends="init,compile-test">
492
-        <j2seproject1:nbjpdastart name="${test.class}" classpath="${debug.test.classpath}"/>
572
+    <target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test">
573
+        <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/>
493 574
     </target>
494
-    <target name="debug-test" depends="init,compile-test,-debug-start-debugger-test,-debug-start-debuggee-test"/>
495
-    <target name="-do-debug-fix-test" if="netbeans.home" depends="init,-pre-debug-fix,compile-test-single">
575
+    <target depends="init,-do-not-recompile,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/>
576
+    <target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test">
496 577
         <j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/>
497 578
     </target>
498
-    <target name="debug-fix-test" if="netbeans.home" depends="init,-pre-debug-fix,-do-debug-fix-test"/>
579
+    <target depends="init,-pre-debug-fix,-do-debug-fix-test" if="netbeans.home" name="debug-fix-test"/>
499 580
     <!--
500
-    =========================
501
-    APPLET EXECUTION SECTION
502
-    =========================
503
-    -->
504
-    <target name="run-applet" depends="init,compile-single">
581
+                =========================
582
+                APPLET EXECUTION SECTION
583
+                =========================
584
+            -->
585
+    <target depends="init,compile-single" name="run-applet">
505 586
         <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
506 587
         <j2seproject1:java classname="sun.applet.AppletViewer">
507 588
             <customize>
@@ -510,11 +591,11 @@ is divided into following sections:
510 591
         </j2seproject1:java>
511 592
     </target>
512 593
     <!--
513
-    =========================
514
-    APPLET DEBUGGING  SECTION
515
-    =========================
516
-    -->
517
-    <target name="-debug-start-debuggee-applet" if="netbeans.home" depends="init,compile-single">
594
+                =========================
595
+                APPLET DEBUGGING  SECTION
596
+                =========================
597
+            -->
598
+    <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-applet">
518 599
         <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
519 600
         <j2seproject3:debug classname="sun.applet.AppletViewer">
520 601
             <customize>
@@ -522,14 +603,14 @@ is divided into following sections:
522 603
             </customize>
523 604
         </j2seproject3:debug>
524 605
     </target>
525
-    <target name="debug-applet" if="netbeans.home" depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet"/>
606
+    <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet" if="netbeans.home" name="debug-applet"/>
526 607
     <!--
527
-    ===============
528
-    CLEANUP SECTION
529
-    ===============
530
-    -->
531
-    <target name="deps-clean" depends="init" unless="no.deps"/>
532
-    <target name="-do-clean" depends="init">
608
+                ===============
609
+                CLEANUP SECTION
610
+                ===============
611
+            -->
612
+    <target depends="init" name="deps-clean" unless="no.deps"/>
613
+    <target depends="init" name="-do-clean">
533 614
         <delete dir="${build.dir}"/>
534 615
         <delete dir="${dist.dir}"/>
535 616
     </target>
@@ -537,5 +618,5 @@ is divided into following sections:
537 618
         <!-- Empty placeholder for easier customization. -->
538 619
         <!-- You can override this target in the ../build.xml file. -->
539 620
     </target>
540
-    <target name="clean" depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products."/>
621
+    <target depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products." name="clean"/>
541 622
 </project>

+ 3
- 3
nbproject/genfiles.properties View File

@@ -3,6 +3,6 @@ build.xml.script.CRC32=ef7aa04d
3 3
 build.xml.stylesheet.CRC32=240b97a2
4 4
 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
5 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=42229879
7
-nbproject/build-impl.xml.script.CRC32=07e37bde
8
-nbproject/build-impl.xml.stylesheet.CRC32=20b9345e
6
+nbproject/build-impl.xml.data.CRC32=bd5a0d51
7
+nbproject/build-impl.xml.script.CRC32=71da8a92
8
+nbproject/build-impl.xml.stylesheet.CRC32=eb00e44a

+ 69
- 2
src/com/dmdirc/parser/ChannelInfo.java View File

@@ -29,6 +29,7 @@ import java.util.Hashtable;
29 29
 import java.util.HashMap;
30 30
 import java.util.LinkedList;
31 31
 import java.util.Map;
32
+import java.util.Queue;
32 33
 
33 34
 /**
34 35
  * Contains Channel information.
@@ -77,6 +78,13 @@ public final class ChannelInfo {
77 78
 	private LinkedList<String> lModeQueue = new LinkedList<String>();
78 79
 	/** A Map to allow applications to attach misc data to this object */
79 80
 	private Map myMap;
81
+	
82
+	/** Queue of requested list modes */
83
+	private Queue<Character> listModeQueue = new LinkedList<Character>();
84
+	/** Listmode Queue Time */
85
+	private long listModeQueueTime = System.currentTimeMillis();
86
+	/** Have we asked the server for the list modes for this channel yet? */
87
+	private boolean askedForListModes = false;
80 88
 
81 89
 	/**
82 90
 	 * Create a new channel object.
@@ -90,6 +98,60 @@ public final class ChannelInfo {
90 98
 		sName = name;
91 99
 	}
92 100
 	
101
+	/**
102
+	 * Get the listModeQueue
103
+	 *
104
+	 * @return The listModeQueue
105
+	 */
106
+	public Queue<Character> getListModeQueue() {
107
+		Queue<Character> result = listModeQueue;
108
+		final long now = System.currentTimeMillis();
109
+		// Incase of breakage, if getListModeQueue() was last called greater than
110
+		// 60 seconds ago, we reset the list.
111
+		if (now-(30*1000) > listModeQueueTime) {
112
+			result = new LinkedList<Character>();
113
+			myParser.callDebugInfo(myParser.DEBUG_LMQ, "Resetting LMQ");
114
+		}
115
+		listModeQueueTime = now;
116
+		return result;
117
+	}
118
+	
119
+	/**
120
+	 * Ask the server for all the list modes for this channel.
121
+	 */
122
+	public void requestListModes() {
123
+		askedForListModes = true;
124
+		int modecount = 1;
125
+		try { 
126
+			modecount = Integer.parseInt(myParser.h005Info.get("MODES"));
127
+		} catch (NumberFormatException e) { /* use default modecount */}
128
+		
129
+		String listmodes = "";
130
+		int i = 0;
131
+		for (Character cTemp : myParser.hChanModesOther.keySet()) {
132
+			int nTemp = myParser.hChanModesOther.get(cTemp);
133
+			if (nTemp == myParser.MODE_LIST) {
134
+				i++;
135
+				listmodes = listmodes + cTemp;
136
+				if (i >= modecount) {
137
+					myParser.sendString("MODE "+getName()+" "+listmodes);
138
+					i = 0;
139
+					listmodes = "";
140
+				}
141
+			}
142
+		}
143
+		if (i > 0) { myParser.sendString("MODE "+getName()+" "+listmodes); }
144
+	}
145
+	
146
+	/**
147
+	 * Have we ever asked the server for this channels listmodes?
148
+	 *
149
+	 * @return True if requestListModes() has ever been used, else false
150
+	 */
151
+	public boolean hasAskedForListModes() {
152
+		return askedForListModes;
153
+	}
154
+	
93 155
 	/**
94 156
 	 * Set the Map object attatched to this object.
95 157
 	 *
@@ -379,9 +441,14 @@ public final class ChannelInfo {
379 441
 		else if (myParser.hChanModesOther.get(cMode) != myParser.MODE_LIST) { return; }
380 442
 		
381 443
 		// Hyperion sucks.
382
-		if (cMode == 'b') {
444
+		if (cMode == 'b' || cMode == 'q') {
383 445
 			final String thisIRCD = myParser.getIRCD(true).toLowerCase();
384
-			if ((thisIRCD.equals("hyperion") || thisIRCD.equals("dancer")) {
446
+			if ((thisIRCD.equals("hyperion") || thisIRCD.equals("dancer"))) {
447
+				if (cMode == 'b' && givenItem.getItem().charAt(0) == '%') {
448
+					cMode = 'q';
449
+				} else if (cMode == 'q' && givenItem.getItem().charAt(0) != '%') {
450
+					cMode = 'b';
451
+				}
385 452
 				if (givenItem.getItem().charAt(0) == '%') {
386 453
 					newItem = new ChannelListModeItem(givenItem.getItem().substring(1), givenItem.getOwner(), givenItem.getTime());
387 454
 				}

+ 53
- 8
src/com/dmdirc/parser/IRCParser.java View File

@@ -53,6 +53,7 @@ import java.util.Arrays;
53 53
 import java.util.Collection;
54 54
 import java.util.Hashtable;
55 55
 import java.util.Timer;
56
+import java.util.Queue;
56 57
 
57 58
 import javax.net.ssl.SSLContext;
58 59
 import javax.net.ssl.SSLSocketFactory;
@@ -76,7 +77,9 @@ public final class IRCParser implements Runnable {
76 77
 	public static final int DEBUG_SOCKET = 2;
77 78
 	/** Processing Manager Debug Information. */
78 79
 	public static final int DEBUG_PROCESSOR = 4;
79
-//	public static final int DEBUG_SOMETHING = 8; //Next thingy
80
+	/** List Mode Queue Debug Information. */
81
+	public static final int DEBUG_LMQ = 8;
82
+//	public static final int DEBUG_SOMETHING = 16; //Next thingy
80 83
 
81 84
 	/** Socket is not created yet. */
82 85
 	public static final byte STATE_NULL = 0;
@@ -244,6 +247,9 @@ public final class IRCParser implements Runnable {
244 247
 	/** Should fake (channel)clients be created for callbacks where they do not exist? */
245 248
 	boolean createFake = false;
246 249
 	
250
+	/** Should channels automatically request list modes? */
251
+	boolean autoListMode = true;
252
+	
247 253
 	/** Should part/quit/kick callbacks be fired before removing the user internally? */
248 254
 	boolean removeAfterCallback = true;
249 255
 		
@@ -309,6 +315,20 @@ public final class IRCParser implements Runnable {
309 315
 	 */
310 316
 	public void setCreateFake(final boolean newValue) { createFake = newValue; }
311 317
 	
318
+	/**
319
+	 * Get the current Value of autoListMode.
320
+	 *
321
+	 * @return Value of autoListMode (true if channels automatically ask for list modes on join, else false)
322
+	 */
323
+	public boolean getAutoListMode() { return autoListMode; }
324
+	
325
+	/**
326
+	 * Set the current Value of autoListMode.
327
+	 *
328
+	 * @param newValue New value to set autoListMode
329
+	 */
330
+	public void setAutoListMode(final boolean newValue) { autoListMode = newValue; }
331
+
312 332
 	/**
313 333
 	 * Get the current Value of removeAfterCallback.
314 334
 	 *
@@ -838,8 +858,10 @@ public final class IRCParser implements Runnable {
838 858
 	 * @return ChannelInfo Object for the channel, or null
839 859
 	 */
840 860
 	public ChannelInfo getChannelInfo(String sWhat) {
841
-		sWhat = toLowerCase(sWhat);
842
-		if (hChannelList.containsKey(sWhat)) { return hChannelList.get(sWhat); } else { return null; }
861
+		synchronized (hChannelList) {
862
+			sWhat = toLowerCase(sWhat);
863
+			if (hChannelList.containsKey(sWhat)) { return hChannelList.get(sWhat); } else { return null; }
864
+		}
843 865
 	}
844 866
 	
845 867
 	/**
@@ -869,6 +891,19 @@ public final class IRCParser implements Runnable {
869 891
 		final String[] newLine = tokeniseLine(line);
870 892
 		if (newLine[0].equalsIgnoreCase("away") && newLine.length > 1) {
871 893
 			cMyself.setAwayReason(newLine[newLine.length-1]);
894
+		} else if (newLine[0].equalsIgnoreCase("mode") && newLine.length == 3) {
895
+			ChannelInfo channel = getChannelInfo(newLine[1]);
896
+			if (channel != null) {
897
+				Queue<Character> listModeQueue = channel.getListModeQueue();
898
+				for (int i = 0; i < newLine[2].length() ; ++i) {
899
+					Character mode = newLine[2].charAt(i);
900
+					callDebugInfo(DEBUG_LMQ, "Intercepted mode request for "+channel+" for mode "+mode);
901
+					if (hChanModesOther.containsKey(mode) && hChanModesOther.get(mode) == MODE_LIST) {
902
+						listModeQueue.offer(mode);
903
+						callDebugInfo(DEBUG_LMQ, "Added to LMQ");
904
+					}
905
+				}
906
+			}
872 907
 		}
873 908
 	}
874 909
 	
@@ -1932,7 +1967,9 @@ public final class IRCParser implements Runnable {
1932 1967
 	 * @param channel Channel to add
1933 1968
 	 */
1934 1969
 	public void addChannel(final ChannelInfo channel) {
1935
-		hChannelList.put(toLowerCase(channel.getName()), channel);
1970
+		synchronized (hChannelList) {
1971
+			hChannelList.put(toLowerCase(channel.getName()), channel);
1972
+		}
1936 1973
 	}
1937 1974
 
1938 1975
 	/**
@@ -1941,7 +1978,9 @@ public final class IRCParser implements Runnable {
1941 1978
 	 * @param channel Channel to remove
1942 1979
 	 */
1943 1980
 	public void removeChannel(final ChannelInfo channel) {
1944
-		hChannelList.remove(toLowerCase(channel.getName()));
1981
+		synchronized (hChannelList) {
1982
+			hChannelList.remove(toLowerCase(channel.getName()));
1983
+		}
1945 1984
 	}
1946 1985
 
1947 1986
 	/**
@@ -1950,7 +1989,9 @@ public final class IRCParser implements Runnable {
1950 1989
 	 * @return Count of known channel
1951 1990
 	 */
1952 1991
 	public int knownChannels() {
1953
-		return hChannelList.size();
1992
+		synchronized (hChannelList) {
1993
+			return hChannelList.size();
1994
+		}
1954 1995
 	}
1955 1996
 
1956 1997
 	/**
@@ -1959,14 +2000,18 @@ public final class IRCParser implements Runnable {
1959 2000
 	 * @return Known channels as a collection
1960 2001
 	 */
1961 2002
 	public Collection<ChannelInfo> getChannels() {
1962
-		return hChannelList.values();
2003
+		synchronized (hChannelList) {
2004
+			return hChannelList.values();
2005
+		}
1963 2006
 	}
1964 2007
 
1965 2008
 	/**
1966 2009
 	 * Clear the channel list
1967 2010
 	 */
1968 2011
 	public void clearChannels() {
1969
-		hChannelList.clear();
2012
+		synchronized (hChannelList) {
2013
+			hChannelList.clear();
2014
+		}
1970 2015
 	}
1971 2016
 
1972 2017
 	/**

+ 5
- 6
src/com/dmdirc/parser/ProcessJoin.java View File

@@ -71,10 +71,8 @@ public class ProcessJoin extends IRCProcessor {
71 71
 				myParser.addChannel(iChannel);
72 72
 				sendString("MODE "+iChannel.getName());
73 73
 				
74
-				// Find out the lists currently in use
75
-				for (Character cTemp : myParser.hChanModesOther.keySet()) {
76
-					nTemp = myParser.hChanModesOther.get(cTemp);
77
-					if (nTemp == myParser.MODE_LIST) { sendString("MODE "+iChannel.getName()+" "+cTemp); }
74
+				if (myParser.getAutoListMode()) {
75
+					iChannel.requestListModes();
78 76
 				}
79 77
 				callChannelSelfJoin(iChannel);
80 78
 			} else {
@@ -93,15 +91,16 @@ public class ProcessJoin extends IRCProcessor {
93 91
 				}
94 92
 			}
95 93
 		}
96
-	}	
94
+	}
97 95
 	
96
+
98 97
 	/**
99 98
 	 * Callback to all objects implementing the ChannelJoin Callback.
100 99
 	 *
101 100
 	 * @see IChannelJoin
102 101
 	 * @param cChannel Channel Object
103 102
 	 * @param cChannelClient ChannelClient object for new person
104
-         * @return true if a method was called, false otherwise
103
+	 * @return true if a method was called, false otherwise
105 104
 	 */
106 105
 	protected boolean callChannelJoin(ChannelInfo cChannel, ChannelClientInfo cChannelClient) {
107 106
 		CallbackOnChannelJoin cb = (CallbackOnChannelJoin)getCallbackManager().getCallbackType("OnChannelJoin");

+ 43
- 3
src/com/dmdirc/parser/ProcessListModes.java View File

@@ -24,6 +24,9 @@
24 24
 
25 25
 package com.dmdirc.parser;
26 26
 
27
+import java.util.LinkedList;
28
+import java.util.Queue;
29
+
27 30
 // import com.dmdirc.parser.callbacks.;
28 31
 // import com.dmdirc.parser.callbacks.interfaces.;
29 32
 
@@ -34,9 +37,10 @@ public class ProcessListModes extends IRCProcessor {
34 37
 	/**
35 38
 	 * Process a ListModes.
36 39
 	 *
37
-	 * @param sParam Type of line to process ("348", "349", "346", "347", "367", "368")
40
+	 * @param sParam Type of line to process ("348", "349", "346", "347", "367", "368", "482")
38 41
 	 * @param token IRCTokenised line to process
39 42
 	 */
43
+	@SuppressWarnings("unchecked")
40 44
 	public void process(String sParam, String[] token) {
41 45
 		ChannelInfo channel = getChannelInfo(token[3]);
42 46
 		String thisIRCD = myParser.getIRCD(true).toLowerCase();
@@ -48,6 +52,7 @@ public class ProcessListModes extends IRCProcessor {
48 52
 		char mode = 'b';
49 53
 		boolean isItem = true; // true if item listing, false if "end of .." item
50 54
 		if (channel == null) { return; }
55
+		
51 56
 		if (sParam.equals("367") || sParam.equals("368")) {
52 57
 			// Ban List/Item.
53 58
 			// (Also used for +d and +q on hyperion... -_-)
@@ -75,8 +80,39 @@ public class ProcessListModes extends IRCProcessor {
75 80
 			isCleverMode = true;
76 81
 		}
77 82
 		
83
+		final Queue<Character> listModeQueue = channel.getListModeQueue();
84
+		if (!isCleverMode && listModeQueue != null) {
85
+			if (sParam.equals("482")) {
86
+				myParser.callDebugInfo(myParser.DEBUG_LMQ, "Dropped LMQ mode "+listModeQueue.poll());
87
+			} else {
88
+				if (listModeQueue.peek() != null) {
89
+					Character oldMode = mode;
90
+					mode = listModeQueue.peek();
91
+					myParser.callDebugInfo(myParser.DEBUG_LMQ, "LMQ says this is "+mode);
92
+					if (oldMode != mode) {
93
+						myParser.callDebugInfo(myParser.DEBUG_LMQ, "LMQ disagrees with guess LMQ: "+mode+" Guess: "+oldMode);
94
+					}
95
+					if ((thisIRCD.equals("hyperion") || thisIRCD.equals("dancer")) && (mode == 'b' || mode == 'q')) {
96
+						LinkedList<Character> lmq = (LinkedList<Character>)listModeQueue;
97
+						if (mode == 'b') {
98
+							lmq.remove((Character)'q');
99
+							myParser.callDebugInfo(myParser.DEBUG_LMQ, "Dropping q from list");
100
+						} else if (mode == 'q') {
101
+							lmq.remove((Character)'b');
102
+							myParser.callDebugInfo(myParser.DEBUG_LMQ, "Dropping b from list");
103
+						}
104
+					}
105
+					if (!isItem) {
106
+						listModeQueue.poll();
107
+					}
108
+				}
109
+			}
110
+		}
111
+		
112
+		if (sParam.equals("482")) { return; }
113
+		
78 114
 		if (isItem) {
79
-			if ((!isCleverMode) && (thisIRCD.equals("hyperion") || thisIRCD.equals("dancer"))) {
115
+			if ((!isCleverMode) && listModeQueue == null && (thisIRCD.equals("hyperion") || thisIRCD.equals("dancer"))) {
80 116
 				if (token.length > 4) {
81 117
 					if (mode == 'b') {
82 118
 						// Assume mode is a 'd' mode
@@ -123,7 +159,7 @@ public class ProcessListModes extends IRCProcessor {
123 159
 	 * @return String[] with the names of the tokens we handle.
124 160
 	 */
125 161
 	public String[] handles() {
126
-		String[] iHandle = new String[9];
162
+		String[] iHandle = new String[10];
127 163
 		int i = 0;
128 164
 		// Ban List - All IRCds
129 165
 		iHandle[i++] = "367"; // Item
@@ -145,6 +181,10 @@ public class ProcessListModes extends IRCProcessor {
145 181
 		iHandle[i++] = "348"; // Item
146 182
 		iHandle[i++] = "349"; // End
147 183
 		
184
+		// "Only operator can do that"
185
+		// This pops an item off the list mode queue
186
+		iHandle[i++] = "482"; // End
187
+		
148 188
 		// This is here to allow finding the processor for adding LISTMODE support
149 189
 		iHandle[i++] = "__LISTMODE__";
150 190
 		return iHandle;

Loading…
Cancel
Save