Преглед на файлове

Version -> 0.5.1RC1

Removed non core plugins


git-svn-id: http://svn.dmdirc.com/tags/0.5.1@2294 00569f92-eb28-0410-84fd-f71c24880f
0.5.1
Gregory Holmes преди 16 години
родител
ревизия
8e698cfac7
променени са 24 файла, в които са добавени 2 реда и са изтрити 2333 реда
  1. 2
    2
      src/com/dmdirc/Main.java
  2. 0
    113
      src/com/dmdirc/addons/audio/AudioCommand.java
  3. 0
    140
      src/com/dmdirc/addons/audio/AudioPlayer.java
  4. 0
    100
      src/com/dmdirc/addons/audio/AudioPlugin.java
  5. 0
    88
      src/com/dmdirc/addons/dcop/DcopCommand.java
  6. 0
    111
      src/com/dmdirc/addons/dcop/DcopPlugin.java
  7. 0
    26
      src/com/dmdirc/addons/dcop/package-info.java
  8. 0
    62
      src/com/dmdirc/addons/mediasources/dcop/AmarokSource.java
  9. 0
    87
      src/com/dmdirc/addons/mediasources/dcop/DcopMediaSourcePlugin.java
  10. 0
    63
      src/com/dmdirc/addons/mediasources/dcop/KaffeineSource.java
  11. 0
    62
      src/com/dmdirc/addons/mediasources/dcop/NoatunSource.java
  12. 0
    115
      src/com/dmdirc/addons/mediasources/windows/GetMediaInfo.dpr
  13. Двоични данни
      src/com/dmdirc/addons/mediasources/windows/GetMediaInfo.exe
  14. 0
    62
      src/com/dmdirc/addons/nowplaying/MediaSource.java
  15. 0
    42
      src/com/dmdirc/addons/nowplaying/MediaSourceManager.java
  16. 0
    89
      src/com/dmdirc/addons/nowplaying/plugin/ConfigPanel.java
  17. 0
    77
      src/com/dmdirc/addons/nowplaying/plugin/MediaSourceComparator.java
  18. 0
    164
      src/com/dmdirc/addons/nowplaying/plugin/NowPlayingCommand.java
  19. 0
    283
      src/com/dmdirc/addons/nowplaying/plugin/NowPlayingPlugin.java
  20. 0
    148
      src/com/dmdirc/addons/redirectplugin/FakeInputWindow.java
  21. 0
    73
      src/com/dmdirc/addons/redirectplugin/RedirectCommand.java
  22. 0
    80
      src/com/dmdirc/addons/redirectplugin/RedirectPlugin.java
  23. 0
    320
      src/com/dmdirc/addons/windowstatus/WindowStatusPlugin.java
  24. 0
    26
      src/com/dmdirc/addons/windowstatus/package-info.java

+ 2
- 2
src/com/dmdirc/Main.java Целия файл

@@ -48,12 +48,12 @@ public final class Main {
48 48
     /**
49 49
      * Stores the current textual program version.
50 50
      */
51
-    public static final String VERSION = "SVN";
51
+    public static final String VERSION = "0.5.1RC1";
52 52
     
53 53
     /**
54 54
      * Stores the release date of this version.
55 55
      */
56
-    public static final int RELEASE_DATE = 0;
56
+    public static final int RELEASE_DATE = 20070928;
57 57
     
58 58
     /**
59 59
      * Stores the update channel that this version came from, if any.

+ 0
- 113
src/com/dmdirc/addons/audio/AudioCommand.java Целия файл

@@ -1,113 +0,0 @@
1
-/*
2
- * Copyright (c) 2006-2007 Chris Smith, Shane Mc Cormack, Gregory Holmes
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.dmdirc.addons.audio;
24
-
25
-import com.dmdirc.commandparser.CommandManager;
26
-import com.dmdirc.commandparser.commands.GlobalCommand;
27
-import com.dmdirc.plugins.Plugin;
28
-import com.dmdirc.plugins.PluginManager;
29
-import com.dmdirc.ui.interfaces.InputWindow;
30
-import java.io.File;
31
-import java.io.IOException;
32
-
33
-/**
34
- * The Audio Command allows playing of audio files.
35
- *
36
- * @author Shane "Dataforce" Mc Cormack
37
- * @version $Id: AudioCommand.java 969 2007-04-30 18:38:20Z ShaneMcC $
38
- */
39
-public final class AudioCommand extends GlobalCommand {
40
-
41
-	/**
42
-	 * Creates a new instance of LoggingCommand.
43
-	 */
44
-	public AudioCommand() {
45
-		super();
46
-		CommandManager.registerCommand(this);
47
-	}
48
-		
49
-	/**
50
-	 * Executes this command.
51
-	 *
52
-	 * @param origin The frame in which this command was issued
53
-	 * @param server The server object that this command is associated with
54
-	 * @param isSilent Whether this command is silenced or not
55
-	 * @param args The user supplied arguments
56
-	 */
57
-	public void execute(final InputWindow origin, final boolean isSilent, final String... args) {
58
-		final String filename = implodeArgs(args);
59
-		final File file = new File(filename);
60
-		if (file.exists()) {
61
-			if (AudioPlayer.isValid(file)) {
62
-				new AudioPlayer(file).start();
63
-			} else {
64
-				sendLine(origin, isSilent, "commandError", "Invalid file type");
65
-			}
66
-		} else {
67
-			sendLine(origin, isSilent, "commandError", "File does not exist");
68
-		}
69
-	}
70
-
71
-	/**
72
-	 * Returns this command's name.
73
-	 *
74
-	 * @return The name of this command
75
-	 */
76
-	public String getName() { return "audio"; }
77
-	
78
-	/**
79
-	 * Returns whether or not this command should be shown in help messages.
80
-	 *
81
-	 * @return True iff the command should be shown, false otherwise
82
-	 */
83
-	public boolean showInHelp() { return true; }
84
-	
85
-	/**
86
-	 * Indicates whether this command is polyadic or not.
87
-	 *
88
-	 * @return True iff this command is polyadic, false otherwise
89
-	 */
90
-	public boolean isPolyadic() { return true; }
91
-	
92
-	/**
93
-	 * Returns the arity of this command.
94
-	 *
95
-	 * @return This command's arity
96
-	 */
97
-	public int getArity() { return 0; }
98
-	
99
-	/**
100
-	 * Returns a string representing the help message for this command.
101
-	 *
102
-	 * @return the help message for this command
103
-	 */
104
-	public String getHelp() { return this.getName() + " <file>"; }
105
-	
106
-	/**
107
-	 * Get SVN Version information.
108
-	 *
109
-	 * @return SVN Version String
110
-	 */
111
-	public static String getSvnInfo() { return "$Id: AudioCommand.java 969 2007-04-30 18:38:20Z ShaneMcC $"; }	
112
-}
113
-

+ 0
- 140
src/com/dmdirc/addons/audio/AudioPlayer.java Целия файл

@@ -1,140 +0,0 @@
1
-/*
2
- * Copyright (c) 2006-2007 Chris Smith, Shane Mc Cormack, Gregory Holmes
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.dmdirc.addons.audio;
24
-
25
-import javax.sound.sampled.AudioInputStream;
26
-import javax.sound.sampled.AudioSystem;
27
-import javax.sound.sampled.AudioFormat;
28
-import javax.sound.sampled.SourceDataLine;
29
-import javax.sound.sampled.DataLine;
30
-import java.io.File;
31
-import java.io.IOException;
32
-
33
-/**
34
- * The AudioPlayer handles the playing of the audio
35
- *
36
- * @author Shane "Dataforce" Mc Cormack
37
- * @version $Id: AudioPlayer.java 969 2007-04-30 18:38:20Z ShaneMcC $
38
- */
39
-public final class AudioPlayer extends Thread {
40
-	/** The AudioType enum */
41
-	private enum AudioType { WAV, OTHER; }
42
-	
43
-	/** The file object of the file to play */
44
-	final File myFile;
45
-	
46
-	/**
47
-	 * Create the AudioPlayer
48
-	 *
49
-	 * @param file The file to play
50
-	 */
51
-	public AudioPlayer(final File file) {
52
-		myFile = file;
53
-	}
54
-	
55
-	/**
56
-	 * Run this AudioPlayer
57
-	 */
58
-	public void run() {
59
-		final AudioType type = getAudioType(myFile);
60
-		switch (type) {
61
-			case WAV:
62
-				playWav();
63
-				break;
64
-			default:
65
-				break;
66
-		}
67
-	}
68
-	
69
-	/**
70
-	 * Check if this File is a supported file type
71
-	 *
72
-	 * @param file the File to check
73
-	 * @return true if playable, else false.
74
-	 */
75
-	public static boolean isValid(final File file) {
76
-		final AudioType type = getAudioType(file);
77
-		return (type != AudioType.OTHER);
78
-	}
79
-	
80
-	/**
81
-	 * Get the AudioType of a given file
82
-	 *
83
-	 * @param file the File to check
84
-	 * @return AudioType for this file.
85
-	 */
86
-	public static AudioType getAudioType(final File file) {
87
-		AudioType type;
88
-		try {
89
-			AudioSystem.getAudioInputStream(file);
90
-			type = AudioType.WAV;
91
-		} catch (Exception e) {
92
-			type = AudioType.OTHER;
93
-		}
94
-		return type;
95
-	}
96
-	
97
-	/**
98
-	 * Play the file as a wav file.
99
-	 * Based on http://www.anyexample.com/programming/java/java_play_wav_sound_file.xml
100
-	 *
101
-	 */
102
-	private void playWav() {
103
-		final int EXTERNAL_BUFFER_SIZE = 524288; // 128Kb
104
-		AudioInputStream audioInputStream = null;
105
-		try {
106
-			audioInputStream = AudioSystem.getAudioInputStream(myFile);
107
-		} catch (Exception e) { return; }
108
-		
109
-		AudioFormat format = audioInputStream.getFormat();
110
-		SourceDataLine auline = null;
111
-		DataLine.Info info = new DataLine.Info(SourceDataLine.class, format);
112
-		
113
-		try {
114
-			auline = (SourceDataLine) AudioSystem.getLine(info);
115
-			auline.open(format);
116
-		} catch (Exception e) { return; }
117
-		
118
-		auline.start();
119
-		int nBytesRead = 0;
120
-		byte[] abData = new byte[EXTERNAL_BUFFER_SIZE];
121
- 
122
-		try {
123
-			while (nBytesRead != -1) {
124
-				nBytesRead = audioInputStream.read(abData, 0, abData.length);
125
-				if (nBytesRead >= 0) {
126
-					auline.write(abData, 0, nBytesRead);
127
-				}
128
-			}
129
-		} catch (Exception e) {
130
-			/** Do Nothing */
131
-		} finally {
132
-			auline.drain();
133
-			auline.close();
134
-		}
135
-		try {
136
-			audioInputStream.close();
137
-		} catch (Exception e) { }
138
-	}
139
-}
140
-

+ 0
- 100
src/com/dmdirc/addons/audio/AudioPlugin.java Целия файл

@@ -1,100 +0,0 @@
1
-/*
2
- * Copyright (c) 2006-2007 Chris Smith, Shane Mc Cormack, Gregory Holmes
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.dmdirc.addons.audio;
24
-
25
-import com.dmdirc.plugins.Plugin;
26
-import com.dmdirc.commandparser.CommandManager;
27
-/**
28
- * Adds Audio playing facility to client.
29
- *
30
- * @author Shane 'Dataforce' McCormack
31
- * @version $Id: AudioPlugin.java 969 2007-04-30 18:38:20Z ShaneMcC $
32
- */
33
-public final class AudioPlugin extends Plugin {
34
-	/** The AudioCommand we created */
35
-	private AudioCommand command = null;
36
-
37
-	/**
38
-	 * Creates a new instance of the Audio Plugin.
39
-	 */
40
-	public AudioPlugin() { super(); }
41
-	
42
-	/**
43
-	 * Called when the plugin is loaded.
44
-	 *
45
-	 * @return false if the plugin can not be loaded
46
-	 */
47
-	public boolean onLoad() {
48
-		return true;
49
-	}
50
-	
51
-	/**
52
-	 * Called when this plugin is activated.
53
-	 */
54
-	public void onActivate() {
55
-		command = new AudioCommand();
56
-	}
57
-	
58
-	/**
59
-	 * Called when this plugin is deactivated.
60
-	 */
61
-	public void onDeactivate() {
62
-		CommandManager.unregisterCommand(command);
63
-	}
64
-
65
-	/**
66
-	 * Get the plugin version.
67
-	 *
68
-	 * @return Plugin Version
69
-	 */
70
-	public String getVersion() { return "0.1"; }
71
-	
72
-	/**
73
-	 * Get the plugin Author.
74
-	 *
75
-	 * @return Author of plugin
76
-	 */
77
-	public String getAuthor() { return "Shane <shane@dmdirc.com>"; }
78
-	
79
-	/**
80
-	 * Get the plugin Description.
81
-	 *
82
-	 * @return Description of plugin
83
-	 */
84
-	public String getDescription() { return "Allows playing audio files"; }
85
-	
86
-	/**
87
-	 * Get the name of the plugin (used in "Manage Plugins" dialog).
88
-	 *
89
-	 * @return Name of plugin
90
-	 */
91
-	public String toString() { return "Audio Plugin"; }
92
-	
93
-	/**
94
-	 * Get SVN Version information.
95
-	 *
96
-	 * @return SVN Version String
97
-	 */
98
-	public static String getSvnInfo() { return "$Id: IRCParser.java 969 2007-04-30 18:38:20Z ShaneMcC $"; }	
99
-}
100
-

+ 0
- 88
src/com/dmdirc/addons/dcop/DcopCommand.java Целия файл

@@ -1,88 +0,0 @@
1
-/*
2
- * Copyright (c) 2006-2007 Chris Smith, Shane Mc Cormack, Gregory Holmes
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.dmdirc.addons.dcop;
24
-
25
-import com.dmdirc.Server;
26
-import com.dmdirc.commandparser.CommandManager;
27
-import com.dmdirc.commandparser.commands.ServerCommand;
28
-import com.dmdirc.ui.interfaces.InputWindow;
29
-
30
-import java.util.List;
31
-
32
-/**
33
- * The dcop command retrieves information from a dcop application.
34
- * @author chris
35
- */
36
-public final class DcopCommand extends ServerCommand {
37
-    
38
-    /**
39
-     * Creates a new instance of DcopCommand.
40
-     */
41
-    public DcopCommand() {
42
-        super();
43
-        
44
-        CommandManager.registerCommand(this);
45
-    }
46
-    
47
-    /**
48
-     * Executes this command.
49
-     * @param origin The frame in which this command was issued
50
-     * @param server The server object that this command is associated with
51
-     * @param isSilent Whether this command is silenced or not
52
-     * @param args The user supplied arguments
53
-     */
54
-    public void execute(final InputWindow origin, final Server server,
55
-            final boolean isSilent, final String... args) {
56
-        final List<String> res = DcopPlugin.getDcopResult("dcop " + implodeArgs(args));
57
-        for (String line : res) {
58
-            sendLine(origin, isSilent, "commandOutput", line);
59
-        }
60
-    }
61
-    
62
-    
63
-    /** {@inheritDoc}. */
64
-    public String getName() {
65
-        return "dcop";
66
-    }
67
-    
68
-    /** {@inheritDoc}. */
69
-    public boolean showInHelp() {
70
-        return true;
71
-    }
72
-    
73
-    /** {@inheritDoc}. */
74
-    public boolean isPolyadic() {
75
-        return false;
76
-    }
77
-    
78
-    /** {@inheritDoc}. */
79
-    public int getArity() {
80
-        return 3;
81
-    }
82
-    
83
-    /** {@inheritDoc}. */
84
-    public String getHelp() {
85
-        return "dcop <app> <object> <function> - retrieves information from a DCOP aplication";
86
-    }
87
-    
88
-}

+ 0
- 111
src/com/dmdirc/addons/dcop/DcopPlugin.java Целия файл

@@ -1,111 +0,0 @@
1
-/*
2
- * Copyright (c) 2006-2007 Chris Smith, Shane Mc Cormack, Gregory Holmes
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.dmdirc.addons.dcop;
24
-
25
-import com.dmdirc.plugins.Plugin;
26
-
27
-import java.io.BufferedReader;
28
-import java.io.IOException;
29
-import java.io.InputStreamReader;
30
-import java.util.ArrayList;
31
-import java.util.List;
32
-
33
-/**
34
- * Allows the user to execute dcop commands (and read the results).
35
- * 
36
- * @author chris
37
- */
38
-public final class DcopPlugin extends Plugin {
39
-    
40
-    /** Creates a new instance of DcopPlugin. */
41
-    public DcopPlugin() {
42
-        super();
43
-    }
44
-    
45
-    /**
46
-     * Retrieves the result from executing the specified command.
47
-     *
48
-     * @param command The command to be executed
49
-     * @return The output of the specified command
50
-     */
51
-    public static List<String> getDcopResult(final String command) {
52
-        final ArrayList<String> result = new ArrayList<String>();
53
-
54
-        InputStreamReader reader;
55
-        BufferedReader input;
56
-        Process process;
57
-        
58
-        try {
59
-            process = Runtime.getRuntime().exec(command);
60
-            
61
-            reader = new InputStreamReader(process.getInputStream());
62
-            input = new BufferedReader(reader);
63
-            
64
-            String line = "";
65
-            
66
-            while ((line = input.readLine()) != null) {
67
-                result.add(line);
68
-            }
69
-            
70
-            reader.close();
71
-            input.close();
72
-            process.destroy();
73
-        } catch (IOException ex) {
74
-            // Do nothing
75
-        }
76
-        
77
-        return result;
78
-    }
79
-    
80
-    /** {@inheritDoc}. */
81
-    public boolean onLoad() {
82
-        new DcopCommand();
83
-        
84
-        return true;
85
-    }
86
-    
87
-    /** {@inheritDoc}. */
88
-    public String getVersion() {
89
-        return "0.2";
90
-    }
91
-    
92
-    /** {@inheritDoc}. */
93
-    public String getAuthor() {
94
-        return "Chris <chris@dmdirc.com>";
95
-    }
96
-    
97
-    /** {@inheritDoc}. */
98
-    public String getDescription() {
99
-        return "Provides commands to interface with DCOP applications";
100
-    }
101
-    
102
-    /** {@inheritDoc}. */
103
-    public boolean isConfigurable() {
104
-        return false;
105
-    }
106
-    
107
-    /** {@inheritDoc}. */
108
-    public String toString() {
109
-        return "DCOP Plugin";
110
-    }
111
-}

+ 0
- 26
src/com/dmdirc/addons/dcop/package-info.java Целия файл

@@ -1,26 +0,0 @@
1
-/*
2
- * Copyright (c) 2006-2007 Chris Smith, Shane Mc Cormack, Gregory Holmes
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
-/**
24
- * DCOP interface for DMDirc.
25
- */
26
-package com.dmdirc.addons.dcop;

+ 0
- 62
src/com/dmdirc/addons/mediasources/dcop/AmarokSource.java Целия файл

@@ -1,62 +0,0 @@
1
-/*
2
- * Copyright (c) 2006-2007 Chris Smith, Shane Mc Cormack, Gregory Holmes
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.dmdirc.addons.mediasources.dcop;
24
-
25
-import com.dmdirc.addons.dcop.DcopPlugin;
26
-import com.dmdirc.addons.nowplaying.MediaSource;
27
-
28
-/**
29
- * Uses DCOP to retrieve now playing info from Amarok.
30
- *
31
- * @author chris
32
- */
33
-public class AmarokSource implements MediaSource {
34
-    
35
-    /** Instantiates the media source. */
36
-    public AmarokSource() {
37
-        //Do nothing
38
-    }
39
-    
40
-    /** {@inheritDoc} */
41
-    public boolean isRunning() {
42
-        return DcopPlugin.getDcopResult("dcop amarok player isPlaying").size() > 0;
43
-    }
44
-    
45
-    /** {@inheritDoc} */
46
-    public boolean isPlaying() {
47
-        final String result = DcopPlugin.getDcopResult("dcop amarok player isPlaying").get(0);
48
-        
49
-        return Boolean.parseBoolean(result);
50
-    }
51
-    
52
-    /** {@inheritDoc} */
53
-    public String getInformation() {
54
-        return DcopPlugin.getDcopResult("dcop amarok player nowPlaying").get(0);
55
-    }
56
-    
57
-    /** {@inheritDoc} */
58
-    public String getName() {
59
-        return "Amarok";
60
-    }
61
-    
62
-}

+ 0
- 87
src/com/dmdirc/addons/mediasources/dcop/DcopMediaSourcePlugin.java Целия файл

@@ -1,87 +0,0 @@
1
-/*
2
- * Copyright (c) 2006-2007 Chris Smith, Shane Mc Cormack, Gregory Holmes
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.dmdirc.addons.mediasources.dcop;
24
-
25
-import com.dmdirc.addons.nowplaying.MediaSource;
26
-import com.dmdirc.addons.nowplaying.MediaSourceManager;
27
-import com.dmdirc.plugins.Plugin;
28
-import com.dmdirc.plugins.PluginManager;
29
-
30
-import java.util.ArrayList;
31
-import java.util.Arrays;
32
-import java.util.List;
33
-
34
-/**
35
- * Manages all DCOP based media sources.
36
- */
37
-public class DcopMediaSourcePlugin extends Plugin
38
-        implements MediaSourceManager {
39
-    
40
-    /** Media sources. */
41
-    private final List<MediaSource> sources;
42
-    
43
-    /**
44
-     * Creates a new instance of DcopMediaSourcePlugin.
45
-     */
46
-    public DcopMediaSourcePlugin() {
47
-        super();
48
-        sources = new ArrayList<MediaSource>();
49
-        sources.add(new AmarokSource());
50
-        sources.add(new KaffeineSource());
51
-        sources.add(new NoatunSource());
52
-    }
53
-    
54
-    /** {@inheritDoc} */
55
-    public List<MediaSource> getSources() {
56
-        return sources;
57
-    }
58
-    
59
-    /** {@inheritDoc} */
60
-    public boolean onLoad() {
61
-        if (Arrays.asList(PluginManager.getPluginManager().getNames()).
62
-                contains("com.dmdirc.addons.dcop.dcopplugin")) {
63
-            return true;
64
-        }
65
-        return false;
66
-    }
67
-    
68
-    /** {@inheritDoc} */
69
-    public String getVersion() {
70
-        return "0.1";
71
-    }
72
-    
73
-    /** {@inheritDoc} */
74
-    public String getAuthor() {
75
-        return "Greboid <greboid@dmdirc.com>";
76
-    }
77
-    
78
-    /** {@inheritDoc} */
79
-    public String getDescription() {
80
-        return "Provides DCOP media sources for the now playing plugin";
81
-    }
82
-    
83
-    /** {@inheritDoc} */
84
-    public String toString() {
85
-        return "DCOP media sources";
86
-    }
87
-}

+ 0
- 63
src/com/dmdirc/addons/mediasources/dcop/KaffeineSource.java Целия файл

@@ -1,63 +0,0 @@
1
-/*
2
- * Copyright (c) 2006-2007 Chris Smith, Shane Mc Cormack, Gregory Holmes
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.dmdirc.addons.mediasources.dcop;
24
-
25
-import com.dmdirc.addons.dcop.DcopPlugin;
26
-import com.dmdirc.addons.nowplaying.MediaSource;
27
-
28
-/**
29
- * Uses DCOP to retrieve now playing info from Kaffeine.
30
- *
31
- * @author chris
32
- */
33
-public class KaffeineSource implements MediaSource {
34
-    
35
-    /** Instantiates the media source. */
36
-    public KaffeineSource() {
37
-        //Do nothing
38
-    }
39
-    
40
-    /** {@inheritDoc} */
41
-    public boolean isRunning() {        
42
-        return DcopPlugin.getDcopResult("dcop kaffeine KaffeineIface isPlaying").size() > 0;
43
-    }
44
-    
45
-    /** {@inheritDoc} */
46
-    public boolean isPlaying() {
47
-        final String result = DcopPlugin.getDcopResult("dcop kaffeine KaffeineIface isPlaying").get(0);
48
-        
49
-        return Boolean.parseBoolean(result);
50
-    }
51
-    
52
-    /** {@inheritDoc} */
53
-    public String getInformation() {
54
-        return DcopPlugin.getDcopResult("dcop kaffeine KaffeineIface artist").get(0) + " - "
55
-                + DcopPlugin.getDcopResult("dcop kaffeine KaffeineIface title").get(0);
56
-    }
57
-    
58
-    /** {@inheritDoc} */
59
-    public String getName() {
60
-        return "Kaffeine";
61
-    }
62
-    
63
-}

+ 0
- 62
src/com/dmdirc/addons/mediasources/dcop/NoatunSource.java Целия файл

@@ -1,62 +0,0 @@
1
-/*
2
- * Copyright (c) 2006-2007 Chris Smith, Shane Mc Cormack, Gregory Holmes
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.dmdirc.addons.mediasources.dcop;
24
-
25
-import com.dmdirc.addons.dcop.DcopPlugin;
26
-import com.dmdirc.addons.nowplaying.MediaSource;
27
-
28
-/**
29
- * Uses DCOP to retrieve now playing info from Noatun.
30
- *
31
- * @author chris
32
- */
33
-public class NoatunSource implements MediaSource {
34
-    
35
-    /** Instantiates the media source. */
36
-    public NoatunSource() {
37
-        //Do nothing
38
-    }
39
-    
40
-    /** {@inheritDoc} */
41
-    public boolean isRunning() {       
42
-        return DcopPlugin.getDcopResult("dcop noatun Noatun state").size() > 0;
43
-    }
44
-    
45
-    /** {@inheritDoc} */
46
-    public boolean isPlaying() {
47
-        final String result = DcopPlugin.getDcopResult("dcop noatun Noatun state").get(0);
48
-        
49
-        return "2".equals(result.trim());
50
-    }
51
-    
52
-    /** {@inheritDoc} */
53
-    public String getInformation() {
54
-        return DcopPlugin.getDcopResult("dcop noatun Noatun title").get(0);
55
-    }
56
-    
57
-    /** {@inheritDoc} */
58
-    public String getName() {
59
-        return "Noatun";
60
-    }
61
-    
62
-}

+ 0
- 115
src/com/dmdirc/addons/mediasources/windows/GetMediaInfo.dpr Целия файл

@@ -1,115 +0,0 @@
1
-{*
2
- * This application attempts to load mirc-compatible dlls for media source information
3
- * This will fail with anything that actually relies on knowing the mirc window
4
- * handles
5
- *
6
- * DMDirc - Open Source IRC Client
7
- * Copyright (c) 2006-2007 Chris Smith, Shane Mc Cormack, Gregory Holmes
8
- * 
9
- * Permission is hereby granted, free of charge, to any person obtaining a copy
10
- * of this software and associated documentation files (the "Software"), to deal
11
- * in the Software without restriction, including without limitation the rights
12
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
- * copies of the Software, and to permit persons to whom the Software is
14
- * furnished to do so, subject to the following conditions:
15
- * 
16
- * The above copyright notice and this permission notice shall be included in
17
- * all copies or substantial portions of the Software.
18
- * 
19
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
- * SOFTWARE.
26
- *}
27
-program GetMediaInfo;
28
-{$MODE Delphi}
29
-
30
-uses Windows, sysutils;
31
-
32
-type
33
-	TLoadInfo = packed record
34
-		mVersion: DWORD;
35
-		mHwnd: HWND;
36
-		mKeep: Boolean;
37
-	end;
38
-	PLoadInfo = ^TLoadInfo;
39
-
40
-var
41
-	I: Integer;
42
-	Player: String;
43
-	MethodName: String;
44
-	DLL: HINST;
45
-	
46
-	Method: function (mWnd: HWND; aWnd: HWND; data: PChar; parms: PChar; show: boolean; nopause: boolean): integer; stdcall;
47
-	LoadDLLMethod: procedure (LoadInfo: PLoadInfo); stdcall;
48
-	UnloadDLLMethod: function (mTimeOut: integer): integer; stdcall;
49
-	LoadInfo: PLoadInfo;
50
-	Data: PChar;
51
-	Params: PChar;
52
-begin
53
-	// By default, assume fail.
54
-	ExitCode := 1;
55
-
56
-	if ParamCount > 1 then MethodName := paramstr(2) else MethodName := 'GetTrackName';
57
-	
58
-	if ParamCount > 0 then begin
59
-		Player := paramstr(1);
60
-		DLL := LoadLibrary(PChar(Player+'.dll'));
61
-		
62
-		if DLL <> HINST(0) then begin
63
-			// DLL Exists and is loaded, we need to try to call LoadDLL first
64
-			LoadInfo := new(PLoadInfo);
65
-			LoadInfo.mVersion := MakeLong(6, 30); // Pretend to be mirc 6.3
66
-			LoadInfo.mHwnd := HWND(nil);
67
-			LoadInfo.mKeep := false;
68
-			LoadDLLMethod := GetProcAddress(DLL, 'LoadDll');
69
-			if @LoadDLLMethod <> nil then LoadDLLMethod(LoadInfo);
70
-			
71
-			// Now the actual method we want!
72
-			Method := GetProcAddress(DLL, PChar(MethodName));
73
-			if @Method <> nil then begin
74
-				// mirc help says the maximum size for these are 900
75
-				// I use 1024 mostly cos its a nicer number, but also if for some reason
76
-				// more than the amount allocated here gets used by the DLL, we run into
77
-				// all sorts of horrible nasty memory issues!
78
-				// We don't actually use Params, but some DLLs might write to it, so
79
-				// we have to allocate it aswell to prevent previously mentioned memory
80
-				// issues!
81
-				try
82
-					GetMem(Data, 1024);
83
-					GetMem(Params, 1024);
84
-					I := Method(HWND(nil), HWND(nil), Data, Params, true, true);
85
-					if I = 3 then begin
86
-						writeln(Data);
87
-						ExitCode := 0;
88
-					end
89
-					else begin
90
-						writeln('Method Exists, but incompatible');
91
-						writeln('I: '+inttostr(I));
92
-						writeln('Data: '+Data);
93
-						writeln('Params: '+Params);
94
-					end;
95
-				finally
96
-					FreeMem(Data);
97
-					FreeMem(Params);
98
-				end;
99
-			end
100
-			else begin
101
-				writeln('No Method ('+MethodName+') Found');
102
-			end;
103
-			
104
-			// Now attempt to unload
105
-			UnloadDLLMethod := GetProcAddress(DLL, 'UnloadDll');
106
-			if @UnloadDLLMethod <> nil then UnloadDLLMethod(0);
107
-		end
108
-		else begin
109
-			writeln('No DLL ('+Player+'.dll) Found');
110
-		end;
111
-	end
112
-	else begin
113
-		writeln('No Player Given');
114
-	end;
115
-end.

Двоични данни
src/com/dmdirc/addons/mediasources/windows/GetMediaInfo.exe Целия файл


+ 0
- 62
src/com/dmdirc/addons/nowplaying/MediaSource.java Целия файл

@@ -1,62 +0,0 @@
1
-/*
2
- * Copyright (c) 2006-2007 Chris Smith, Shane Mc Cormack, Gregory Holmes
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.dmdirc.addons.nowplaying;
24
-
25
-/**
26
- * The media source describes one source of "now playing" information
27
- * (i.e., one method of getting information from one media player).
28
- * 
29
- * @author chris
30
- */
31
-public interface MediaSource {
32
-    
33
-    /**
34
-     * Determine if the application for this source is running or not.
35
-     * 
36
-     * @return True if this source is running, false otherwise
37
-     */
38
-    boolean isRunning();
39
-    
40
-    /**
41
-     * Determine if this source is currently playing or not.
42
-     * 
43
-     * @return True if this source is playing, false otherwise
44
-     */
45
-    boolean isPlaying();
46
-    
47
-    /**
48
-     * Retrieves a nicely formatted string containing the relevant information
49
-     * about the source media (such as artist and title).
50
-     * 
51
-     * @return The currently playing media
52
-     */
53
-    String getInformation();
54
-    
55
-    /**
56
-     * Retrieves the name of the application that this source is for.
57
-     * 
58
-     * @return This source's application name
59
-     */
60
-    String getName();
61
-
62
-}

+ 0
- 42
src/com/dmdirc/addons/nowplaying/MediaSourceManager.java Целия файл

@@ -1,42 +0,0 @@
1
-/*
2
- * Copyright (c) 2006-2007 Chris Smith, Shane Mc Cormack, Gregory Holmes
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.dmdirc.addons.nowplaying;
24
-
25
-import java.util.List;
26
-
27
-/**
28
- * The media source manager is a standard interface for an object that controls
29
- * one or more media sources.
30
- * 
31
- * @author chris
32
- */
33
-public interface MediaSourceManager {
34
-    
35
-    /**
36
-     * Retrieves the sources that this manager manages.
37
-     * 
38
-     * @return A list of sources that this manager manages
39
-     */
40
-    public List<MediaSource> getSources();
41
-    
42
-}

+ 0
- 89
src/com/dmdirc/addons/nowplaying/plugin/ConfigPanel.java Целия файл

@@ -1,89 +0,0 @@
1
-/*
2
- * Copyright (c) 2006-2007 Chris Smith, Shane Mc Cormack, Gregory Holmes
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.dmdirc.addons.nowplaying.plugin;
24
-
25
-import com.dmdirc.ui.swing.components.reorderablelist.ReorderableJList;
26
-import static com.dmdirc.ui.swing.UIUtilities.SMALL_BORDER;
27
-
28
-import java.awt.BorderLayout;
29
-import java.util.Enumeration;
30
-import java.util.LinkedList;
31
-import java.util.List;
32
-
33
-import javax.swing.JLabel;
34
-import javax.swing.JPanel;
35
-import javax.swing.JScrollPane;
36
-
37
-/**
38
- * Now playing plugin config panel.
39
- */
40
-public class ConfigPanel extends JPanel {
41
-    
42
-    /**
43
-     * A version number for this class. It should be changed whenever the class
44
-     * structure is changed (or anything else that would prevent serialized
45
-     * objects being unserialized with the new class).
46
-     */
47
-    private static final long serialVersionUID = 1;
48
-    
49
-    /** Media source order list. */
50
-    private ReorderableJList list;
51
-    
52
-    /** Media sources. */
53
-    private final List<String> sources;
54
-    
55
-    /** Creates a new instance of ConfigPanel. */
56
-    public ConfigPanel(final List<String> sources) {
57
-        super();
58
-        
59
-        this.sources = new LinkedList<String>(sources);
60
-        
61
-        initComponents();
62
-    }
63
-    
64
-    /** Initialises the components. */
65
-    private void initComponents() {
66
-        list = new ReorderableJList();
67
-        
68
-        for (String source : sources) {
69
-            list.getModel().addElement(source);
70
-        }
71
-        
72
-        setLayout(new BorderLayout(SMALL_BORDER, SMALL_BORDER));
73
-        
74
-        add(new JLabel("Media source order: "), BorderLayout.PAGE_START);
75
-        add(new JScrollPane(list), BorderLayout.CENTER);
76
-    }
77
-    
78
-    public List<String> getSources() {
79
-        final List<String> newSources = new LinkedList<String>();
80
-        
81
-        final Enumeration<?> values = list.getModel().elements();
82
-        
83
-        while (values.hasMoreElements()) {
84
-            newSources.add((String) values.nextElement());
85
-        }
86
-        
87
-        return newSources;
88
-    }
89
-}

+ 0
- 77
src/com/dmdirc/addons/nowplaying/plugin/MediaSourceComparator.java Целия файл

@@ -1,77 +0,0 @@
1
-/*
2
- * Copyright (c) 2006-2007 Chris Smith, Shane Mc Cormack, Gregory Holmes
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.dmdirc.addons.nowplaying.plugin;
24
-
25
-import com.dmdirc.addons.nowplaying.MediaSource;
26
-
27
-import java.io.Serializable;
28
-import java.util.Comparator;
29
-import java.util.List;
30
-
31
-/**
32
- * Sorts media sources according to an ordered list of their names.
33
- *
34
- * @author chris
35
- */
36
-public class MediaSourceComparator implements Comparator<MediaSource>, Serializable {
37
-    
38
-    /**
39
-     * A version number for this class. It should be changed whenever the class
40
-     * structure is changed (or anything else that would prevent serialized
41
-     * objects being unserialized with the new class).
42
-     */
43
-    private static final long serialVersionUID = 1;
44
-    
45
-    /** The order that the sources should be checked. */
46
-    private final List<String> order;
47
-    
48
-    /**
49
-     * Creates a new instance of MediaSourceComparator.
50
-     * NB: The order list may be altered during comparisons.
51
-     *
52
-     * @param order An ordered list of media source names
53
-     */
54
-    public MediaSourceComparator(final List<String> order) {
55
-        this.order = order;
56
-    }
57
-
58
-    /** {@inheritDoc} */
59
-    public int compare(final MediaSource o1, final MediaSource o2) {
60
-        return getPosition(o1) - getPosition(o2);
61
-    }
62
-    
63
-    /**
64
-     * Retrieves the position of the source within the order list.
65
-     * If the source is not present it is appended to the list.
66
-     *
67
-     * @param source The media source to be tested
68
-     */
69
-    private int getPosition(final MediaSource source) {
70
-        if (!order.contains(source.getName())) {
71
-            order.add(source.getName());
72
-        }
73
-        
74
-        return order.indexOf(source.getName());
75
-    }
76
-    
77
-}

+ 0
- 164
src/com/dmdirc/addons/nowplaying/plugin/NowPlayingCommand.java Целия файл

@@ -1,164 +0,0 @@
1
-/*
2
- * Copyright (c) 2006-2007 Chris Smith, Shane Mc Cormack, Gregory Holmes
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.dmdirc.addons.nowplaying.plugin;
24
-
25
-import com.dmdirc.MessageTarget;
26
-import com.dmdirc.Server;
27
-import com.dmdirc.addons.nowplaying.MediaSource;
28
-import com.dmdirc.commandparser.commands.ChatCommand;
29
-import com.dmdirc.commandparser.CommandManager;
30
-import com.dmdirc.commandparser.commands.IntelligentCommand;
31
-import com.dmdirc.ui.input.AdditionalTabTargets;
32
-import com.dmdirc.ui.interfaces.InputWindow;
33
-
34
-import java.util.List;
35
-
36
-/**
37
- * The now playing command retrieves the currently playing song from a
38
- * variety of media players.
39
- * @author chris
40
- */
41
-public final class NowPlayingCommand extends ChatCommand implements IntelligentCommand {
42
-    
43
-    /** The plugin that's using this command. */
44
-    final NowPlayingPlugin parent;
45
-    
46
-    /**
47
-     * Creates a new instance of NowPlayingCommand.
48
-     *
49
-     * @param parent The plugin that's instansiating this command
50
-     */
51
-    public NowPlayingCommand(final NowPlayingPlugin parent) {
52
-        super();
53
-        
54
-        this.parent = parent;
55
-        
56
-        CommandManager.registerCommand(this);
57
-    }
58
-    
59
-    /** {@inheritDoc} */
60
-    public void execute(final InputWindow origin, final Server server,
61
-            final MessageTarget target, final boolean isSilent, final String ... args) {
62
-        if (args.length > 0 && args[0].equalsIgnoreCase("--sources")) {
63
-            doSourceList(origin, isSilent);
64
-        } else if (args.length > 0 && args[0].equalsIgnoreCase("--source")) {
65
-            if (args.length > 1) {
66
-                final String sourceName = args[1];
67
-                final MediaSource source = parent.getSource(sourceName);
68
-                
69
-                if (source == null) {
70
-                    sendLine(origin, isSilent, "commandError", "Source not found.");
71
-                } else {
72
-                    if (source.isRunning()) {
73
-                        target.sendAction("is playing " + source.getInformation());
74
-                    } else {
75
-                        sendLine(origin, isSilent, "commandError", "Source is not running.");
76
-                    }
77
-                }
78
-            } else {
79
-                sendLine(origin, isSilent, "commandError", "You must specify a source when using --source.");
80
-            }
81
-        } else {
82
-            if (parent.hasRunningSource()) {
83
-                target.sendAction("is playing " + parent.getBestSource().getInformation());
84
-            } else {
85
-                sendLine(origin, isSilent, "commandError", "No running media sources available.");
86
-            }
87
-        }
88
-    }
89
-    
90
-    /**
91
-     * Outputs a list of sources for the nowplaying command.
92
-     *
93
-     * @param origin The input window where the command was entered
94
-     * @param isSilent Whether this command is being silenced
95
-     */
96
-    private void doSourceList(final InputWindow origin, final boolean isSilent) {
97
-        final List<MediaSource> sources = parent.getSources();
98
-        
99
-        if (sources.isEmpty()) {
100
-            sendLine(origin, isSilent, "commandError", "No media sources available.");
101
-        } else {
102
-            String status;
103
-            
104
-            for (MediaSource source : sources) {
105
-                if (source.isRunning()) {
106
-                    if (source.isPlaying()) {
107
-                        status = "playing: " + source.getInformation();
108
-                    } else {
109
-                        status = "paused: " + source.getInformation();
110
-                    }
111
-                } else {
112
-                    status = "not running";
113
-                }
114
-                sendLine(origin, isSilent, "commandOutput", source.getName() + ": " + status);
115
-            }
116
-        }
117
-    }
118
-    
119
-    /** {@inheritDoc}. */
120
-    public String getName() {
121
-        return "nowplaying";
122
-    }
123
-    
124
-    /** {@inheritDoc}. */
125
-    public boolean showInHelp() {
126
-        return true;
127
-    }
128
-    
129
-    /** {@inheritDoc}. */
130
-    public boolean isPolyadic() {
131
-        return true;
132
-    }
133
-    
134
-    /** {@inheritDoc}. */
135
-    public int getArity() {
136
-        return 0;
137
-    }
138
-    
139
-    /** {@inheritDoc}. */
140
-    public String getHelp() {
141
-        return "nowplaying [--sources|--source <source>] - tells the channel the song you're currently playing";
142
-    }
143
-    
144
-    /** {@inheritDoc} */
145
-    public AdditionalTabTargets getSuggestions(int arg, List<String> previousArgs) {
146
-        final AdditionalTabTargets res = new AdditionalTabTargets();
147
-        
148
-        res.setIncludeNormal(false);
149
-        
150
-        if (arg == 0) {
151
-            res.add("--sources");
152
-            res.add("--source");
153
-        } else if (arg == 1 && previousArgs.get(0).equalsIgnoreCase("--source")) {
154
-            for (MediaSource source : parent.getSources()) {
155
-                if (source.isRunning()) {
156
-                    res.add(source.getName());
157
-                }
158
-            }
159
-        }
160
-        
161
-        return res;
162
-    }
163
-    
164
-}

+ 0
- 283
src/com/dmdirc/addons/nowplaying/plugin/NowPlayingPlugin.java Целия файл

@@ -1,283 +0,0 @@
1
-/*
2
- * Copyright (c) 2006-2007 Chris Smith, Shane Mc Cormack, Gregory Holmes
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.dmdirc.addons.nowplaying.plugin;
24
-
25
-import com.dmdirc.Main;
26
-import com.dmdirc.actions.ActionType;
27
-import com.dmdirc.actions.CoreActionType;
28
-import com.dmdirc.addons.nowplaying.MediaSource;
29
-import com.dmdirc.addons.nowplaying.MediaSourceManager;
30
-import com.dmdirc.commandparser.CommandManager;
31
-import com.dmdirc.config.IdentityManager;
32
-import com.dmdirc.plugins.EventPlugin;
33
-import com.dmdirc.plugins.Plugin;
34
-import com.dmdirc.plugins.PluginManager;
35
-import com.dmdirc.ui.interfaces.PreferencesInterface;
36
-import com.dmdirc.ui.interfaces.PreferencesPanel;
37
-
38
-import java.util.ArrayList;
39
-import java.util.Collections;
40
-import java.util.List;
41
-import java.util.Properties;
42
-
43
-public class NowPlayingPlugin extends Plugin implements EventPlugin,
44
-        PreferencesInterface  {
45
-    
46
-    /** Config domain. */
47
-    private static final String DOMAIN = "plugin-nowplaying";
48
-    
49
-    /** The sources that we know of. */
50
-    private final List<MediaSource> sources = new ArrayList<MediaSource>();
51
-    
52
-    /** The now playing command we're registering. */
53
-    private NowPlayingCommand command;
54
-    
55
-    /** Config panel. */
56
-    private ConfigPanel configPanel;
57
-    
58
-    /** The user's preferred order for source usage. */
59
-    private List<String> order;
60
-    
61
-    public NowPlayingPlugin() {
62
-        super();
63
-    }
64
-    
65
-    /** {@inheritDoc} */
66
-    public boolean onLoad() {
67
-        return true;
68
-    }
69
-    
70
-    /** {@inheritDoc} */
71
-    @Override
72
-    protected void onActivate() {
73
-        sources.clear();
74
-        
75
-        loadSettings();
76
-        
77
-        for (Plugin target : PluginManager.getPluginManager().getPlugins()) {
78
-            if (target.isActive()) {
79
-                addPlugin(target);
80
-            }
81
-        }
82
-        
83
-        command = new NowPlayingCommand(this);
84
-    }
85
-    
86
-    /** {@inheritDoc} */
87
-    @Override
88
-    protected void onDeactivate() {
89
-        sources.clear();
90
-        
91
-        CommandManager.unregisterCommand(command);
92
-    }
93
-    
94
-    /** {@inheritDoc} */
95
-    public String getVersion() {
96
-        return "0.2";
97
-    }
98
-    
99
-    /** {@inheritDoc} */
100
-    public String getAuthor() {
101
-        return "Chris <chris@dmdirc.com>";
102
-    }
103
-    
104
-    /** {@inheritDoc} */
105
-    public String getDescription() {
106
-        return "Adds a nowplaying command";
107
-    }
108
-    
109
-    /** {@inheritDoc} */
110
-    public String toString() {
111
-        return "Now playing command";
112
-    }
113
-    
114
-    /** {@inheritDoc} */
115
-    public boolean isConfigurable() {
116
-        return true;
117
-    }
118
-    
119
-    /** {@inheritDoc} */
120
-    public void showConfig() {
121
-        final PreferencesPanel preferencesPanel = Main.getUI().getPreferencesPanel(this, "Now playing Plugin - Config");
122
-        
123
-        configPanel = new ConfigPanel(order);
124
-        
125
-        preferencesPanel.addCategory("General", "General options for the plugin.");
126
-        
127
-        preferencesPanel.replaceOptionPanel("General", configPanel);
128
-        
129
-        preferencesPanel.display();
130
-    }
131
-    
132
-    /** {@inheritDoc} */
133
-    public void configClosed(final Properties properties) {
134
-        order = configPanel.getSources();
135
-        
136
-        saveSettings();
137
-    }
138
-    
139
-    /** {@inheritDoc} */
140
-    public void configCancelled() {
141
-        //Ignore
142
-    }
143
-    
144
-    /** Saves the plugins settings. */
145
-    private void saveSettings() {
146
-        IdentityManager.getConfigIdentity().setOption(DOMAIN, "sourceOrder", order);
147
-    }
148
-    
149
-    /** Loads the plugins settings. */
150
-    private void loadSettings() {
151
-        if (IdentityManager.getGlobalConfig().hasOption(DOMAIN, "sourceOrder")) {
152
-            order = IdentityManager.getGlobalConfig().getOptionList(DOMAIN, "sourceOrder");
153
-        } else {
154
-            order = new ArrayList<String>();
155
-        }
156
-    }
157
-    
158
-    /** {@inheritDoc} */
159
-    public void processEvent(final ActionType type, final StringBuffer format,
160
-            final Object... arguments) {
161
-        if (type == CoreActionType.PLUGIN_ACTIVATED) {
162
-            addPlugin((Plugin) arguments[0]);
163
-        } else if (type == CoreActionType.PLUGIN_DEACTIVATED) {
164
-            removePlugin((Plugin) arguments[0]);
165
-        }
166
-    }
167
-    
168
-    /**
169
-     * Checks to see if a plugin implements one of the Media Source interfaces
170
-     * and if it does, adds the source(s) to our list.
171
-     *
172
-     * @param target The plugin to be tested
173
-     */
174
-    private void addPlugin(final Plugin target) {
175
-        if (target instanceof MediaSource) {
176
-            sources.add((MediaSource) target);
177
-            addSourceToOrder((MediaSource) target);
178
-        }
179
-        
180
-        if (target instanceof MediaSourceManager) {
181
-            sources.addAll(((MediaSourceManager) target).getSources());
182
-            
183
-            for (MediaSource source : ((MediaSourceManager) target).getSources()) {
184
-                addSourceToOrder(source);
185
-            }
186
-        }
187
-    }
188
-    
189
-    /**
190
-     * Checks to see if the specified media source needs to be added to our
191
-     * order list, and adds it if neccessary.
192
-     *
193
-     * @param source The media source to be tested
194
-     */
195
-    private void addSourceToOrder(final MediaSource source) {
196
-        if (!order.contains(source.getName())) {
197
-            order.add(source.getName());
198
-        }
199
-    }
200
-    
201
-    /**
202
-     * Checks to see if a plugin implements one of the Media Source interfaces
203
-     * and if it does, removes the source(s) from our list.
204
-     *
205
-     * @param target The plugin to be tested
206
-     */
207
-    private void removePlugin(final Plugin target) {
208
-        if (target instanceof MediaSource) {
209
-            sources.remove((MediaSource) target);
210
-        }
211
-        
212
-        if (target instanceof MediaSourceManager) {
213
-            sources.removeAll(((MediaSourceManager) target).getSources());
214
-        }
215
-    }
216
-    
217
-    /**
218
-     * Determines if there are any valid sources (paused or not).
219
-     *
220
-     * @return True if there are running sources, false otherwise
221
-     */
222
-    public boolean hasRunningSource() {
223
-        for (final MediaSource source : sources) {
224
-            if (source.isRunning()) {
225
-                return true;
226
-            }
227
-        }
228
-        
229
-        return false;
230
-    }
231
-    
232
-    /**
233
-     * Retrieves the "best" source to use for displaying media information.
234
-     * The best source is defined as the earliest in the list that is running
235
-     * and not paused, or, if no such source exists, the earliest in the list
236
-     * that is running and paused. If neither condition is satisified returns
237
-     * null.
238
-     *
239
-     * @return The best source to use for media info
240
-     */
241
-    public MediaSource getBestSource() {
242
-        MediaSource paused = null;
243
-        
244
-        Collections.sort(sources, new MediaSourceComparator(order));
245
-        
246
-        for (final MediaSource source : sources) {
247
-            if (source.isRunning()) {
248
-                if (source.isPlaying()) {
249
-                    return source;
250
-                } else if (paused == null) {
251
-                    paused = source;
252
-                }
253
-            }
254
-        }
255
-        
256
-        return paused;
257
-    }
258
-    
259
-    /**
260
-     * Retrieves a source based on its name.
261
-     *
262
-     * @param name The name to search for
263
-     * @return The source with the specified name or null if none were found.
264
-     */
265
-    public MediaSource getSource(final String name) {
266
-        for (final MediaSource source : sources) {
267
-            if (source.getName().equalsIgnoreCase(name)) {
268
-                return source;
269
-            }
270
-        }
271
-        
272
-        return null;
273
-    }
274
-    
275
-    /**
276
-     * Retrieves all the sources registered with this plugin.
277
-     *
278
-     * @return All known media sources
279
-     */
280
-    public List<MediaSource> getSources() {
281
-        return new ArrayList<MediaSource>(sources);
282
-    }
283
-}

+ 0
- 148
src/com/dmdirc/addons/redirectplugin/FakeInputWindow.java Целия файл

@@ -1,148 +0,0 @@
1
-/*
2
- * Copyright (c) 2006-2007 Chris Smith, Shane Mc Cormack, Gregory Holmes
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.dmdirc.addons.redirectplugin;
24
-
25
-import com.dmdirc.FrameContainer;
26
-import com.dmdirc.MessageTarget;
27
-import com.dmdirc.util.StringTranscoder;
28
-import com.dmdirc.commandparser.parsers.CommandParser;
29
-import com.dmdirc.config.ConfigManager;
30
-import com.dmdirc.ui.input.InputHandler;
31
-import com.dmdirc.ui.interfaces.InputWindow;
32
-import com.dmdirc.ui.messages.Formatter;
33
-
34
-import java.beans.PropertyVetoException;
35
-import java.nio.charset.Charset;
36
-
37
-import javax.swing.Icon;
38
-
39
-/**
40
- * Implements a fake input window, which sends echoed text to the specified
41
- * chat window instead.
42
- * 
43
- * @author Chris
44
- */
45
-public class FakeInputWindow implements InputWindow {
46
-    
47
-    private final MessageTarget target;
48
-
49
-    /**
50
-     * Creates a new instance of FakeInputWindow.
51
-     * 
52
-     * @param target The message target that output gets sent to
53
-     */
54
-    public FakeInputWindow(final MessageTarget target) {
55
-        this.target = target;
56
-    }
57
-
58
-    /** {@inheritDoc} */
59
-    public CommandParser getCommandParser() {
60
-        return target.getFrame().getCommandParser();
61
-    }
62
-
63
-    /** {@inheritDoc} */
64
-    public InputHandler getInputHandler() {
65
-        return target.getFrame().getInputHandler();
66
-    }
67
-
68
-    /** {@inheritDoc} */
69
-    public void setAwayIndicator(final boolean isAway) {
70
-        // Do nothing
71
-    }
72
-
73
-    /** {@inheritDoc} */
74
-    public void addLine(final String messageType, final Object... args) {
75
-        target.sendLine(Formatter.formatMessage(messageType, args));
76
-    }
77
-
78
-    /** {@inheritDoc} */
79
-    public void addLine(final StringBuffer messageType, final Object... args) {
80
-        addLine(messageType.toString(), args);
81
-    }
82
-
83
-    /** {@inheritDoc} */
84
-    public void addLine(final String line, final boolean timestamp) {
85
-        target.sendLine(line);
86
-    }
87
-
88
-    /** {@inheritDoc} */
89
-    public void clear() {
90
-        // Do nothing
91
-    }
92
-
93
-    /** {@inheritDoc} */
94
-    public ConfigManager getConfigManager() {
95
-        return target.getFrame().getConfigManager();
96
-    }
97
-
98
-    /** {@inheritDoc} */
99
-    public FrameContainer getContainer() {
100
-        return target;
101
-    }
102
-
103
-    /** {@inheritDoc} */
104
-    public boolean isVisible() {
105
-        return false;
106
-    }
107
-
108
-    /** {@inheritDoc} */
109
-    public void setVisible(final boolean isVisible) {
110
-        // Do nothing
111
-    }
112
-
113
-    /** {@inheritDoc} */
114
-    public String getTitle() {
115
-        return "Fake window";
116
-    }
117
-
118
-    /** {@inheritDoc} */
119
-    public boolean isMaximum() {
120
-        return false;
121
-    }
122
-
123
-    /** {@inheritDoc} */
124
-    public void setMaximum(final boolean b) throws PropertyVetoException {
125
-        // Do nothing
126
-    }
127
-
128
-    /** {@inheritDoc} */
129
-    public void setTitle(final String title) {
130
-        // Do nothing
131
-    }
132
-
133
-    /** {@inheritDoc} */
134
-    public void open() {
135
-        // Do nothing
136
-    }
137
-
138
-    /** {@inheritDoc} */
139
-    public void setFrameIcon(final Icon icon) {
140
-        // Do nothing
141
-    }
142
-
143
-    /** {@inheritDoc} */
144
-    public StringTranscoder getTranscoder() {
145
-        return new StringTranscoder(Charset.defaultCharset());
146
-    }
147
-
148
-}

+ 0
- 73
src/com/dmdirc/addons/redirectplugin/RedirectCommand.java Целия файл

@@ -1,73 +0,0 @@
1
-/*
2
- * Copyright (c) 2006-2007 Chris Smith, Shane Mc Cormack, Gregory Holmes
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.dmdirc.addons.redirectplugin;
24
-
25
-import com.dmdirc.MessageTarget;
26
-import com.dmdirc.Server;
27
-import com.dmdirc.commandparser.commands.ChatCommand;
28
-import com.dmdirc.ui.interfaces.InputWindow;
29
-
30
-/**
31
- * The redirect command allows the user to redirect the output from another
32
- * command that would normally echo results locally to a query or channel
33
- * window instead.
34
- *
35
- * @author Chris
36
- */
37
-public class RedirectCommand extends ChatCommand {
38
-    
39
-    public RedirectCommand() {
40
-    }
41
-    
42
-    /** {@inheritDoc} */
43
-    public void execute(final InputWindow origin, final Server server,
44
-            final MessageTarget target, final boolean isSilent, final String... args) {
45
-        target.getFrame().getCommandParser().parseCommand(new FakeInputWindow(target), implodeArgs(args));
46
-    }
47
-    
48
-    /** {@inheritDoc} */
49
-    public String getName() {
50
-        return "redirect";
51
-    }
52
-    
53
-    /** {@inheritDoc} */
54
-    public boolean showInHelp() {
55
-        return true;
56
-    }
57
-    
58
-    /** {@inheritDoc} */
59
-    public boolean isPolyadic() {
60
-        return true;
61
-    }
62
-    
63
-    /** {@inheritDoc} */
64
-    public int getArity() {
65
-        return 0;
66
-    }
67
-    
68
-    /** {@inheritDoc} */
69
-    public String getHelp() {
70
-        return "redirect <command> - sends the output of the command to a channel or query window";
71
-    }
72
-    
73
-}

+ 0
- 80
src/com/dmdirc/addons/redirectplugin/RedirectPlugin.java Целия файл

@@ -1,80 +0,0 @@
1
-/*
2
- * Copyright (c) 2006-2007 Chris Smith, Shane Mc Cormack, Gregory Holmes
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.dmdirc.addons.redirectplugin;
24
-
25
-import com.dmdirc.commandparser.CommandManager;
26
-import com.dmdirc.plugins.Plugin;
27
-    
28
-
29
-/**
30
- * The redirect plugin allows the suer to redirect the output of commands that
31
- * would normally echo their results locally to a channel or chat window instead.
32
- * 
33
- * @author chris
34
- */
35
-public final class RedirectPlugin extends Plugin {
36
-    
37
-    private RedirectCommand command;
38
-    
39
-    /** Creates a new system tray plugin. */
40
-    public RedirectPlugin() {
41
-        super();
42
-        
43
-        command = new RedirectCommand();
44
-    }
45
-    
46
-    /** {@inheritDoc} */
47
-    public boolean onLoad() {
48
-        return true;
49
-    }
50
-    
51
-    /** {@inheritDoc} */
52
-    public void onActivate() {
53
-        CommandManager.registerCommand(command);
54
-    }
55
-    
56
-    /** {@inheritDoc}. */
57
-    public void onDeactivate() {
58
-        CommandManager.unregisterCommand(command);
59
-    }
60
-    
61
-    /** {@inheritDoc} */
62
-    public String getVersion() {
63
-        return "0.1";
64
-    }
65
-    
66
-    /** {@inheritDoc} */
67
-    public String getAuthor() {
68
-        return "Chris <chris@dmdirc.com>";
69
-    }
70
-    
71
-    /** {@inheritDoc} */
72
-    public String getDescription() {
73
-        return "Adds commands to redirect command output to channels";
74
-    }
75
-    
76
-    /** {@inheritDoc}. */
77
-    public String toString() {
78
-        return "Redirect Plugin";
79
-    }
80
-}

+ 0
- 320
src/com/dmdirc/addons/windowstatus/WindowStatusPlugin.java Целия файл

@@ -1,320 +0,0 @@
1
-/*
2
- * Copyright (c) 2006-2007 Chris Smith, Shane Mc Cormack, Gregory Holmes
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.dmdirc.addons.windowstatus;
24
-
25
-import java.awt.BorderLayout;
26
-import java.util.Hashtable;
27
-import java.util.Properties;
28
-
29
-import javax.swing.BorderFactory;
30
-import javax.swing.JLabel;
31
-import javax.swing.JPanel;
32
-import javax.swing.SwingConstants;
33
-
34
-import com.dmdirc.Channel;
35
-import com.dmdirc.FrameContainer;
36
-import com.dmdirc.Main;
37
-import com.dmdirc.Query;
38
-import com.dmdirc.Server;
39
-import com.dmdirc.actions.ActionType;
40
-import com.dmdirc.actions.CoreActionType;
41
-import com.dmdirc.config.IdentityManager;
42
-import com.dmdirc.config.Identity;
43
-import com.dmdirc.parser.ChannelClientInfo;
44
-import com.dmdirc.parser.ChannelInfo;
45
-import com.dmdirc.parser.ClientInfo;
46
-import com.dmdirc.plugins.Plugin;
47
-import com.dmdirc.plugins.EventPlugin;
48
-import com.dmdirc.ui.interfaces.InputWindow;
49
-import com.dmdirc.ui.interfaces.PreferencesInterface;
50
-import com.dmdirc.ui.interfaces.PreferencesPanel;
51
-import com.dmdirc.ui.interfaces.Window;
52
-import java.util.Map.Entry;
53
-
54
-/**
55
- * Displays information related to the current window in the status bar.
56
- *
57
- * @author Shane 'Dataforce' McCormack
58
- * @version $Id: WindowStatusPlugin.java 969 2007-04-30 18:38:20Z ShaneMcC $
59
- */
60
-public final class WindowStatusPlugin extends Plugin implements EventPlugin, PreferencesInterface {
61
-	/** What domain do we store all settings in the global config under. */
62
-	private static final String MY_DOMAIN = "plugin-Logging";
63
-	
64
-	/** The panel we use in the status bar. */
65
-	private final JPanel panel = new JPanel();
66
-	
67
-	/** The label we use to show window status. */
68
-	private final JLabel label = new JLabel(" ??? ");
69
-	
70
-	/** Creates a new instance of WindowStatusPlugin. */
71
-	public WindowStatusPlugin() {
72
-		super();
73
-		//		panel.setPreferredSize(new Dimension(70, 25));
74
-		panel.setLayout(new BorderLayout());
75
-		panel.setBorder(BorderFactory.createEtchedBorder());
76
-		label.setHorizontalAlignment(SwingConstants.CENTER);
77
-		panel.add(label);
78
-	}
79
-	
80
-	/**
81
-	 * Called when the plugin is loaded.
82
-	 *
83
-	 * @return false if the plugin can not be loaded
84
-	 */
85
-	public boolean onLoad() {
86
-		// Set defaults
87
-		Properties defaults = new Properties();
88
-		defaults.setProperty(MY_DOMAIN + "channel.shownone", "true");
89
-		defaults.setProperty(MY_DOMAIN + "channel.noneprefix", "None:");
90
-		defaults.setProperty(MY_DOMAIN + "client.showname", "false");
91
-		defaults.setProperty("identity.name", "WindowStatus Plugin Defaults");
92
-		IdentityManager.addIdentity(new Identity(defaults));
93
-		
94
-		return true;
95
-	}
96
-	
97
-	/**
98
-	 * Called when this plugin is Activated.
99
-	 */
100
-	public void onActivate() {
101
-		Main.getUI().getStatusBar().addComponent(panel);
102
-		updateStatus();
103
-	}
104
-	
105
-	/**
106
-	 * Called when this plugin is deactivated.
107
-	 */
108
-	public void onDeactivate() {
109
-		Main.getUI().getStatusBar().removeComponent(panel);
110
-	}
111
-	
112
-	/**
113
-	 * Get the plugin version.
114
-	 *
115
-	 * @return Plugin Version
116
-	 */
117
-	public String getVersion() { return "0.4"; }
118
-	
119
-	/**
120
-	 * Get the plugin Author.
121
-	 *
122
-	 * @return Author of plugin
123
-	 */
124
-	public String getAuthor() { return "Shane <shane@dmdirc.com>"; }
125
-	
126
-	/**
127
-	 * Get the plugin Description.
128
-	 *
129
-	 * @return Description of plugin
130
-	 */
131
-	public String getDescription() { return "Displays information related to the current window in the status bar."; }
132
-	
133
-	/**
134
-	 * Get the name of the plugin (used in "Manage Plugins" dialog).
135
-	 *
136
-	 * @return Name of plugin
137
-	 */
138
-	public String toString() { return "WindowStatus Plugin"; }
139
-	
140
-	/**
141
-	 * Process an event of the specified type.
142
-	 *
143
-	 * @param type The type of the event to process
144
-	 * @param format Format of messages that are about to be sent. (May be null)
145
-	 * @param arguments The arguments for the event
146
-	 */
147
-	public void processEvent(final ActionType type, final StringBuffer format, final Object... arguments) {
148
-		if (type instanceof CoreActionType) {
149
-			final CoreActionType thisType = (CoreActionType)type;
150
-			switch (thisType) {
151
-			case CLIENT_FRAME_CHANGED:
152
-				updateStatus((FrameContainer)arguments[0]);
153
-				break;
154
-			default:
155
-				break;
156
-			}
157
-		}
158
-	}
159
-	
160
-	/**
161
-	 * Update the window status using the current active window.
162
-	 */
163
-	public void updateStatus() {
164
-		Window active = Main.getUI().getMainWindow().getActiveFrame();
165
-		
166
-		if (active != null) {
167
-			FrameContainer activeFrame = ((InputWindow) active).getContainer();
168
-			updateStatus(activeFrame);
169
-		}
170
-	}
171
-	
172
-	/**
173
-	 * Update the window status using a given FrameContainer as the active frame.
174
-	 *
175
-	 * @param current Window to use when adding status.
176
-	 */
177
-	public void updateStatus(final FrameContainer current) {
178
-		if (current == null) { return; }
179
-		StringBuffer textString = new StringBuffer("");
180
-		
181
-		if (current instanceof Server) {
182
-			Server frame = (Server)current;
183
-			
184
-			textString.append(frame.getName());
185
-		} else if (current instanceof Channel) {
186
-			final Channel frame = (Channel)current;
187
-			final ChannelInfo chan = frame.getChannelInfo();
188
-			final Hashtable<Integer,String> names = new Hashtable<Integer,String>();
189
-			final Hashtable<Integer,Integer> types = new Hashtable<Integer,Integer>();
190
-			
191
-			textString.append(chan.getName());
192
-			textString.append(" - Nicks: "+chan.getUserCount()+" (");
193
-			
194
-			for (ChannelClientInfo client : chan.getChannelClients()) {
195
-				Integer im = client.getImportantModeValue();
196
-				
197
-				if (!names.containsKey(im)) {
198
-					String mode = client.getImportantModePrefix();
199
-					
200
-					if (mode.isEmpty()) {
201
-						if (IdentityManager.getGlobalConfig().getOptionBool(MY_DOMAIN, "channel.shownone")) {
202
-							if (IdentityManager.getGlobalConfig().hasOption(MY_DOMAIN, "channel.noneprefix")) {
203
-								mode = IdentityManager.getGlobalConfig().getOption(MY_DOMAIN, "channel.noneprefix");
204
-							} else {
205
-								mode = "None:";
206
-							}
207
-						} else {
208
-							continue;
209
-						}
210
-					}
211
-					names.put(im, mode);
212
-				}
213
-				
214
-				Integer count = types.get(im);
215
-				
216
-				if (count == null) {
217
-					count = Integer.valueOf(1);
218
-				} else {
219
-					count = count+1;
220
-				}
221
-				types.put(im, count);
222
-			}
223
-			
224
-			boolean isFirst = true;
225
-			
226
-			for (Entry<Integer, Integer> entry : types.entrySet()) {
227
-				if (isFirst) { isFirst = false; } else { textString.append(" "); }
228
-				textString.append(names.get(entry.getKey())+entry.getValue());
229
-			}
230
-			
231
-			textString.append(")");
232
-		} else if (current instanceof Query) {
233
-			final Query frame = (Query)current;
234
-			
235
-			textString.append(frame.getHost());
236
-			if (IdentityManager.getGlobalConfig().getOptionBool(MY_DOMAIN, "client.showname")) {
237
-				final ClientInfo client = frame.getServer().getParser().getClientInfo(frame.getHost());
238
-				if (client != null) {
239
-					final String realname = client.getRealName();
240
-					if (!realname.isEmpty()) {
241
-						textString.append(" - "+client.getRealName());
242
-					}
243
-				}
244
-			}
245
-		}
246
-		label.setText(" "+textString.toString()+" ");
247
-	}
248
-	
249
-	/**
250
-	 * Called to see if the plugin has configuration options (via dialog).
251
-	 *
252
-	 * @return true if the plugin has configuration options via a dialog.
253
-	 */
254
-	public boolean isConfigurable() { return true; }
255
-	
256
-	/**
257
-	 * Called to show the Configuration dialog of the plugin if appropriate.
258
-	 */
259
-	public void showConfig() {
260
-		final PreferencesPanel preferencesPanel = Main.getUI().getPreferencesPanel(this, "Window Status Plugin - Config");
261
-		preferencesPanel.addCategory("Channel", "Configuration for Window Status plugin when showing a channel window.");
262
-		preferencesPanel.addCategory("Client", "Configuration for Window Status plugin when showing a client window.");
263
-		
264
-		preferencesPanel.addCheckboxOption("Channel", "channel.shownone", "Show 'none' count: ", "Should the count for uses with no state be shown?", IdentityManager.getGlobalConfig().getOptionBool(MY_DOMAIN, "channel.shownone"));
265
-		preferencesPanel.addTextfieldOption("Channel", "channel.noneprefix", "Prefix used before 'none' count: ", "The Prefix to use when showing the 'none' count", IdentityManager.getGlobalConfig().getOption(MY_DOMAIN, "channel.noneprefix"));
266
-		
267
-		preferencesPanel.addCheckboxOption("Client", "client.showname", "Show Client realname if known: ", "Should the realname for clients be shown if known?", IdentityManager.getGlobalConfig().getOptionBool(MY_DOMAIN, "client.showname"));
268
-		preferencesPanel.display();
269
-	}
270
-	
271
-	/**
272
-	 * Get the name of the domain we store all settings in the global config under.
273
-	 *
274
-	 * @return the plugins domain
275
-	 */
276
-	protected static String getDomain() { return MY_DOMAIN; }
277
-	
278
-	/**
279
-	 * Copy the new vaule of an option to the global config.
280
-	 *
281
-	 * @param properties Source of option value, or null if setting default values
282
-	 * @param name name of option
283
-	 */
284
-	protected void updateOption(final Properties properties, final String name) {
285
-		String value = null;
286
-		
287
-		// Get the value from the properties file if one is given, else use the
288
-		// value from the global config.
289
-		if (properties != null) {
290
-			value = properties.getProperty(name);
291
-		} else {
292
-			value = IdentityManager.getGlobalConfig().getOption(MY_DOMAIN, name);
293
-		}
294
-		
295
-		// Check if the Value exists
296
-		if (value != null) {
297
-			// It does, so update the global config with the new value
298
-			IdentityManager.getConfigIdentity().setOption(MY_DOMAIN, name, value);
299
-		}
300
-	}
301
-	
302
-	/**
303
-	 * Called when the preferences dialog is closed.
304
-	 *
305
-	 * @param properties user preferences
306
-	 */
307
-	public void configClosed(final Properties properties) {
308
-		// Update Config options
309
-		updateOption(properties, "channel.shownone");
310
-		updateOption(properties, "channel.noneprefix");
311
-		updateOption(properties, "client.showname");
312
-		// Update Status bar
313
-		updateStatus();
314
-	}
315
-	
316
-	/**
317
-	 * Called when the preferences dialog is cancelled.
318
-	 */
319
-	public void configCancelled() { }
320
-}

+ 0
- 26
src/com/dmdirc/addons/windowstatus/package-info.java Целия файл

@@ -1,26 +0,0 @@
1
-/*
2
- * Copyright (c) 2006-2007 Chris Smith, Shane Mc Cormack, Gregory Holmes
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
-/**
24
- * Adds information about the current window to the status bar.
25
- */
26
-package com.dmdirc.addons.windowstatus;

Loading…
Отказ
Запис