mirror of
https://github.com/Mibew/i18n.git
synced 2024-11-15 08:34:12 +03:00
update java applications (from master branch)
This commit is contained in:
parent
09f4af88bf
commit
e198b825ce
4
.gitignore
vendored
4
.gitignore
vendored
@ -1,5 +1,9 @@
|
||||
bin
|
||||
src/messenger/.idea/workspace.xml
|
||||
src/messenger/webim/install/package
|
||||
src/messenger/absent_*
|
||||
src/messenger/release*
|
||||
src/mibewjava/.idea/workspace.xml
|
||||
src/mibewjava/org.mibew.notifier/resources/
|
||||
mibew.ini
|
||||
.DS_Store
|
||||
|
26
README.md
Normal file
26
README.md
Normal file
@ -0,0 +1,26 @@
|
||||
Mibew Messenger
|
||||
===============
|
||||
|
||||
Mibew Messenger is an open-source live support application written
|
||||
in PHP and MySQL. It enables one-on-one chat assistance in real-time
|
||||
directly from your website.
|
||||
|
||||
Server requirements
|
||||
===================
|
||||
|
||||
1. A webserver or web hosting account running on any major Operating System
|
||||
2. PHP (5.x and above) with MySQL support
|
||||
3. MySQL 5.0 and above
|
||||
|
||||
Terms of Use
|
||||
============
|
||||
|
||||
Mibew Messenger is distributed under the terms of the Eclipse Public
|
||||
License (or the General Public License, this means that you can choose
|
||||
one of two, and use it accordingly) with the following special exception.
|
||||
|
||||
License exception:
|
||||
------------------
|
||||
No one may remove, alter or hide any copyright notices or links to the
|
||||
community site (http://mibew.org or http://openwebim.org) contained
|
||||
within the Program. Any derivative work must include this license exception.
|
1
src/mibewjava/.idea/.name
Normal file
1
src/mibewjava/.idea/.name
Normal file
@ -0,0 +1 @@
|
||||
mibew
|
7
src/mibewjava/.idea/ant.xml
Normal file
7
src/mibewjava/.idea/ant.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="AntConfiguration">
|
||||
<defaultAnt bundledAnt="true" />
|
||||
</component>
|
||||
</project>
|
||||
|
22
src/mibewjava/.idea/compiler.xml
Normal file
22
src/mibewjava/.idea/compiler.xml
Normal file
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<option name="DEFAULT_COMPILER" value="Javac" />
|
||||
<resourceExtensions />
|
||||
<wildcardResourcePatterns>
|
||||
<entry name="?*.properties" />
|
||||
<entry name="?*.xml" />
|
||||
<entry name="?*.gif" />
|
||||
<entry name="?*.png" />
|
||||
<entry name="?*.jpeg" />
|
||||
<entry name="?*.jpg" />
|
||||
<entry name="?*.html" />
|
||||
<entry name="?*.dtd" />
|
||||
<entry name="?*.tld" />
|
||||
<entry name="?*.ftl" />
|
||||
<entry name="?*.ini" />
|
||||
</wildcardResourcePatterns>
|
||||
<annotationProcessing enabled="false" useClasspath="true" />
|
||||
</component>
|
||||
</project>
|
||||
|
5
src/mibewjava/.idea/copyright/profiles_settings.xml
Normal file
5
src/mibewjava/.idea/copyright/profiles_settings.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<component name="CopyrightManager">
|
||||
<settings default="">
|
||||
<module2copyright />
|
||||
</settings>
|
||||
</component>
|
5
src/mibewjava/.idea/encodings.xml
Normal file
5
src/mibewjava/.idea/encodings.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
|
||||
</project>
|
||||
|
11
src/mibewjava/.idea/inspectionProfiles/Project_Default.xml
Normal file
11
src/mibewjava/.idea/inspectionProfiles/Project_Default.xml
Normal file
@ -0,0 +1,11 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0" is_locked="false">
|
||||
<option name="myName" value="Project Default" />
|
||||
<option name="myLocal" value="false" />
|
||||
<inspection_tool class="SpellCheckingInspection" enabled="false" level="TYPO" enabled_by_default="false">
|
||||
<option name="processCode" value="true" />
|
||||
<option name="processLiterals" value="true" />
|
||||
<option name="processComments" value="true" />
|
||||
</inspection_tool>
|
||||
</profile>
|
||||
</component>
|
@ -0,0 +1,7 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<settings>
|
||||
<option name="PROJECT_PROFILE" value="Project Default" />
|
||||
<option name="USE_PROJECT_PROFILE" value="true" />
|
||||
<version value="1.0" />
|
||||
</settings>
|
||||
</component>
|
11
src/mibewjava/.idea/libraries/swt.xml
Normal file
11
src/mibewjava/.idea/libraries/swt.xml
Normal file
@ -0,0 +1,11 @@
|
||||
<component name="libraryTable">
|
||||
<library name="swt">
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/org.mibew.notifier/libs/swt-debug.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
<root url="jar://$PROJECT_DIR$/org.mibew.notifier/libs/src.zip!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
33
src/mibewjava/.idea/misc.xml
Normal file
33
src/mibewjava/.idea/misc.xml
Normal file
@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DependencyValidationManager">
|
||||
<option name="SKIP_IMPORT_STATEMENTS" value="false" />
|
||||
</component>
|
||||
<component name="EntryPointsManager">
|
||||
<entry_points version="2.0" />
|
||||
</component>
|
||||
<component name="JavadocGenerationManager">
|
||||
<option name="OUTPUT_DIRECTORY" />
|
||||
<option name="OPTION_SCOPE" value="protected" />
|
||||
<option name="OPTION_HIERARCHY" value="true" />
|
||||
<option name="OPTION_NAVIGATOR" value="true" />
|
||||
<option name="OPTION_INDEX" value="true" />
|
||||
<option name="OPTION_SEPARATE_INDEX" value="true" />
|
||||
<option name="OPTION_DOCUMENT_TAG_USE" value="false" />
|
||||
<option name="OPTION_DOCUMENT_TAG_AUTHOR" value="false" />
|
||||
<option name="OPTION_DOCUMENT_TAG_VERSION" value="false" />
|
||||
<option name="OPTION_DOCUMENT_TAG_DEPRECATED" value="true" />
|
||||
<option name="OPTION_DEPRECATED_LIST" value="true" />
|
||||
<option name="OTHER_OPTIONS" value="" />
|
||||
<option name="HEAP_SIZE" />
|
||||
<option name="LOCALE" />
|
||||
<option name="OPEN_IN_BROWSER" value="true" />
|
||||
</component>
|
||||
<component name="ProjectResources">
|
||||
<default-html-doctype>http://www.w3.org/1999/xhtml</default-html-doctype>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_5" assert-keyword="true" jdk-15="true" project-jdk-name="1.6" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
||||
|
10
src/mibewjava/.idea/modules.xml
Normal file
10
src/mibewjava/.idea/modules.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/org.mibew.api/org.mibew.api.iml" filepath="$PROJECT_DIR$/org.mibew.api/org.mibew.api.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/org.mibew.notifier/org.mibew.notifier.iml" filepath="$PROJECT_DIR$/org.mibew.notifier/org.mibew.notifier.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
|
24
src/mibewjava/.idea/runConfigurations/MibewTray.xml
Normal file
24
src/mibewjava/.idea/runConfigurations/MibewTray.xml
Normal file
@ -0,0 +1,24 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="MibewTray" type="Application" factoryName="Application">
|
||||
<option name="MAIN_CLASS_NAME" value="org.mibew.notifier.NotifyApp" />
|
||||
<option name="VM_PARAMETERS" value="-ea -XstartOnFirstThread" />
|
||||
<option name="PROGRAM_PARAMETERS" value="" />
|
||||
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
|
||||
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||
<option name="ALTERNATIVE_JRE_PATH" value="" />
|
||||
<option name="ENABLE_SWING_INSPECTOR" value="false" />
|
||||
<option name="ENV_VARIABLES" />
|
||||
<option name="PASS_PARENT_ENVS" value="true" />
|
||||
<module name="org.mibew.notifier" />
|
||||
<envs />
|
||||
<RunnerSettings RunnerId="Debug">
|
||||
<option name="DEBUG_PORT" value="50388" />
|
||||
<option name="TRANSPORT" value="0" />
|
||||
<option name="LOCAL" value="true" />
|
||||
</RunnerSettings>
|
||||
<RunnerSettings RunnerId="Run" />
|
||||
<ConfigurationWrapper RunnerId="Debug" />
|
||||
<ConfigurationWrapper RunnerId="Run" />
|
||||
<method />
|
||||
</configuration>
|
||||
</component>
|
125
src/mibewjava/.idea/uiDesigner.xml
Normal file
125
src/mibewjava/.idea/uiDesigner.xml
Normal file
@ -0,0 +1,125 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Palette2">
|
||||
<group name="Swing">
|
||||
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
|
||||
</item>
|
||||
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
|
||||
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
||||
<initial-values>
|
||||
<property name="text" value="Button" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="RadioButton" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="CheckBox" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="Label" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
|
||||
<preferred-size width="-1" height="20" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
|
||||
</item>
|
||||
</group>
|
||||
</component>
|
||||
</project>
|
||||
|
7
src/mibewjava/.idea/vcs.xml
Normal file
7
src/mibewjava/.idea/vcs.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$/../.." vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
|
6
src/mibewjava/org.mibew.api/.classpath
Normal file
6
src/mibewjava/org.mibew.api/.classpath
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
17
src/mibewjava/org.mibew.api/.project
Normal file
17
src/mibewjava/org.mibew.api/.project
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>org.mibew.api</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
13
src/mibewjava/org.mibew.api/org.mibew.api.iml
Normal file
13
src/mibewjava/org.mibew.api/org.mibew.api.iml
Normal file
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="false">
|
||||
<output url="file://$MODULE_DIR$/bin" />
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
|
151
src/mibewjava/org.mibew.api/src/org/mibew/api/MibewAgent.java
Normal file
151
src/mibewjava/org.mibew.api/src/org/mibew/api/MibewAgent.java
Normal file
@ -0,0 +1,151 @@
|
||||
package org.mibew.api;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
/**
|
||||
* @author inspirer
|
||||
*/
|
||||
public class MibewAgent {
|
||||
|
||||
private final MibewAgentOptions fOptions;
|
||||
private final MibewAgentListener fListener;
|
||||
private final MibewUpdateThread fThread;
|
||||
private volatile boolean started;
|
||||
|
||||
public MibewAgent(MibewAgentOptions options, MibewAgentListener listener) {
|
||||
fOptions = options;
|
||||
fListener = listener;
|
||||
fThread = new MibewUpdateThread();
|
||||
started = false;
|
||||
}
|
||||
|
||||
public synchronized void launch() {
|
||||
if(!started) {
|
||||
fThread.start();
|
||||
started = true;
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void stop() {
|
||||
if(started) {
|
||||
fThread.disconnect();
|
||||
started = false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isOnline() {
|
||||
return fThread.isOnline();
|
||||
}
|
||||
|
||||
protected void logError(String message, Throwable th) {
|
||||
System.err.println(message);
|
||||
}
|
||||
|
||||
public MibewAgentOptions getOptions() {
|
||||
return fOptions;
|
||||
}
|
||||
|
||||
private class MibewUpdateThread extends Thread {
|
||||
|
||||
private volatile boolean fExiting;
|
||||
private volatile boolean isOnline = false;
|
||||
private final Object fSync = new Object();
|
||||
|
||||
public MibewUpdateThread() {
|
||||
setName("Mibew Connection thread");
|
||||
fExiting = false;
|
||||
}
|
||||
|
||||
public void disconnect() {
|
||||
synchronized (fSync) {
|
||||
fExiting = true;
|
||||
fSync.notifyAll();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
while(!fExiting) {
|
||||
try {
|
||||
connectAndTrack();
|
||||
} catch(InterruptedException ex) {
|
||||
/* ignore */
|
||||
} catch(Throwable th) {
|
||||
logError(th.getMessage(), th);
|
||||
}
|
||||
}
|
||||
setOnline(false);
|
||||
}
|
||||
|
||||
private void setOnline(boolean online) {
|
||||
if(isOnline != online) {
|
||||
isOnline = online;
|
||||
fListener.onlineStateChanged(online);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isOnline() {
|
||||
return isOnline;
|
||||
}
|
||||
|
||||
private void connectAndTrack() throws InterruptedException, UnsupportedEncodingException, NoSuchAlgorithmException, MalformedURLException, ParserConfigurationException, SAXException {
|
||||
setOnline(false);
|
||||
MibewConnection conn = new MibewConnection(fOptions.getUrl(), fOptions.getLogin(), fOptions.getPassword()) {
|
||||
@Override
|
||||
protected void handleError(String message, Exception ex) {
|
||||
logError(message, ex);
|
||||
}
|
||||
};
|
||||
if(!conn.connect()) {
|
||||
logError("Wrong server, login or password.", null);
|
||||
interruptableSleep(fOptions.getPollingInterval() * 3);
|
||||
return;
|
||||
}
|
||||
final List<MibewThread> createdThreads = new LinkedList<MibewThread>();
|
||||
MibewTracker mt = new MibewTracker(conn, new MibewTrackerListener(){
|
||||
@Override
|
||||
public void threadCreated(MibewThread thread) {
|
||||
createdThreads.add(thread);
|
||||
}
|
||||
});
|
||||
long maxTime = System.currentTimeMillis() + fOptions.getConnectionRefreshTimeout()*1000;
|
||||
|
||||
int errorsCount = 0;
|
||||
while(!fExiting && (System.currentTimeMillis() < maxTime)) {
|
||||
try {
|
||||
createdThreads.clear();
|
||||
mt.update();
|
||||
fListener.updated(mt.getThreads(), createdThreads.toArray(new MibewThread[createdThreads.size()]));
|
||||
errorsCount = 0;
|
||||
setOnline(true);
|
||||
} catch (Throwable th) {
|
||||
setOnline(false);
|
||||
errorsCount++;
|
||||
logError("not updated", th);
|
||||
interruptableSleep(errorsCount < 10 ? fOptions.getPollingInterval() / 2 : fOptions.getPollingInterval() * 2);
|
||||
continue;
|
||||
}
|
||||
interruptableSleep(fOptions.getPollingInterval());
|
||||
}
|
||||
|
||||
conn.disconnect();
|
||||
}
|
||||
|
||||
private void interruptableSleep(long millis) throws InterruptedException {
|
||||
synchronized (fSync ) {
|
||||
if(fExiting) {
|
||||
return;
|
||||
}
|
||||
fSync.wait(millis);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package org.mibew.api;
|
||||
|
||||
public abstract class MibewAgentListener {
|
||||
|
||||
protected void onlineStateChanged(boolean isOnline) {
|
||||
}
|
||||
|
||||
protected void updated(MibewThread[] all, MibewThread[] created) {
|
||||
}
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
package org.mibew.api;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
* @author inspirer
|
||||
*/
|
||||
public class MibewAgentOptions {
|
||||
|
||||
private String fUrl;
|
||||
private String fLogin;
|
||||
private String fPassword;
|
||||
private int fConnectionRefreshTimeout = 900; // in seconds (15 minutes by default)
|
||||
private int fPollingInterval = 2000; // 2 sec (in milliseconds)
|
||||
|
||||
public MibewAgentOptions(String fUrl, String fLogin, String fPassword) {
|
||||
super();
|
||||
this.fUrl = fUrl;
|
||||
this.fLogin = fLogin;
|
||||
this.fPassword = fPassword;
|
||||
}
|
||||
|
||||
public String getLogin() {
|
||||
return fLogin;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return fPassword;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return fUrl;
|
||||
}
|
||||
|
||||
public int getConnectionRefreshTimeout() {
|
||||
return fConnectionRefreshTimeout;
|
||||
}
|
||||
|
||||
public int getPollingInterval() {
|
||||
return fPollingInterval;
|
||||
}
|
||||
|
||||
private static String getProperty(Properties p, String name, String defaultValue) throws IOException {
|
||||
String result = p.getProperty(name);
|
||||
if(result == null) {
|
||||
if(defaultValue != null) {
|
||||
return defaultValue;
|
||||
}
|
||||
throw new IOException("No '"+name+"' property");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static MibewAgentOptions create(Properties p) throws IOException {
|
||||
String url = getProperty(p, "mibew.host", null);
|
||||
String login = getProperty(p, "mibew.login", null);
|
||||
String password = getProperty(p, "mibew.password", null);
|
||||
|
||||
return new MibewAgentOptions(url, login, password);
|
||||
}
|
||||
}
|
172
src/mibewjava/org.mibew.api/src/org/mibew/api/MibewThread.java
Normal file
172
src/mibewjava/org.mibew.api/src/org/mibew/api/MibewThread.java
Normal file
@ -0,0 +1,172 @@
|
||||
package org.mibew.api;
|
||||
|
||||
|
||||
/**
|
||||
* @author inspirer
|
||||
*/
|
||||
public class MibewThread implements Comparable<MibewThread> {
|
||||
|
||||
private final long fId;
|
||||
private String fState;
|
||||
private String fClientName = "";
|
||||
private String fAgent = "";
|
||||
private String fAddress = "";
|
||||
private String fFirstMessage = "";
|
||||
private boolean fCanOpen = false;
|
||||
private boolean fCanView = false;
|
||||
private boolean fCanBan = false;
|
||||
private String fStateText;
|
||||
private long fWaitingTime;
|
||||
|
||||
public MibewThread(long id, String state) {
|
||||
fId = id;
|
||||
fState = state;
|
||||
}
|
||||
|
||||
public void updateFrom(MibewThread updated) {
|
||||
if(fId != updated.fId) {
|
||||
throw new IllegalArgumentException("different threads");
|
||||
}
|
||||
fState = updated.fState;
|
||||
fClientName = updated.fClientName;
|
||||
fAgent = updated.fAgent;
|
||||
fAddress = updated.fAddress;
|
||||
fFirstMessage = updated.fFirstMessage;
|
||||
fCanOpen = updated.fCanOpen;
|
||||
fCanView = updated.fCanView;
|
||||
fCanBan = updated.fCanBan;
|
||||
fStateText = updated.fStateText;
|
||||
fWaitingTime = updated.fWaitingTime;
|
||||
}
|
||||
|
||||
public long getId() {
|
||||
return fId;
|
||||
}
|
||||
|
||||
public String getState() {
|
||||
return fState;
|
||||
}
|
||||
|
||||
public String getStateText() {
|
||||
return fStateText;
|
||||
}
|
||||
|
||||
public void setStateText(String stateText) {
|
||||
fStateText = stateText;
|
||||
}
|
||||
|
||||
public String getAddress() {
|
||||
return fAddress;
|
||||
}
|
||||
|
||||
public void setAddress(String address) {
|
||||
fAddress = address;
|
||||
}
|
||||
|
||||
public String getAgent() {
|
||||
return fAgent;
|
||||
}
|
||||
|
||||
public void setAgent(String agent) {
|
||||
fAgent = agent;
|
||||
}
|
||||
|
||||
public String getClientName() {
|
||||
return fClientName;
|
||||
}
|
||||
|
||||
public void setClientName(String clientName) {
|
||||
fClientName = clientName;
|
||||
}
|
||||
|
||||
public String getFirstMessage() {
|
||||
return fFirstMessage;
|
||||
}
|
||||
|
||||
public void setFirstMessage(String firstMessage) {
|
||||
fFirstMessage = firstMessage;
|
||||
}
|
||||
|
||||
public boolean isCanBan() {
|
||||
return fCanBan;
|
||||
}
|
||||
|
||||
public void setCanBan(boolean canBan) {
|
||||
fCanBan = canBan;
|
||||
}
|
||||
|
||||
public boolean isCanOpen() {
|
||||
return fCanOpen;
|
||||
}
|
||||
|
||||
public void setCanOpen(boolean canOpen) {
|
||||
fCanOpen = canOpen;
|
||||
}
|
||||
|
||||
public boolean isCanView() {
|
||||
return fCanView;
|
||||
}
|
||||
|
||||
public void setCanView(boolean canView) {
|
||||
fCanView = canView;
|
||||
}
|
||||
|
||||
public long getWaitingTime() {
|
||||
return fWaitingTime;
|
||||
}
|
||||
|
||||
public void setWaitingTime(long value) {
|
||||
fWaitingTime = value;
|
||||
}
|
||||
|
||||
public int compareTo(MibewThread o) {
|
||||
int res = index(this).compareTo(index(o));
|
||||
if(res != 0) {
|
||||
return res;
|
||||
}
|
||||
return getClientName().compareTo(o.getClientName());
|
||||
}
|
||||
|
||||
private Integer index(MibewThread th) {
|
||||
if("prio".equals(th.getState())) {
|
||||
return -1;
|
||||
}
|
||||
if("wait".equals(th.getState())) {
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
boolean isChat = "chat".equals(getState());
|
||||
if(isChat) {
|
||||
sb.append("(chat) ");
|
||||
}
|
||||
sb.append(getClientName());
|
||||
if(!isCanOpen() && isCanView()) {
|
||||
sb.append(" (view only)");
|
||||
}
|
||||
if(!isChat) {
|
||||
sb.append(" - ");
|
||||
sb.append(formatWaitingTime((System.currentTimeMillis() - getWaitingTime())/1000));
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private static String atLeast2(long i) {
|
||||
return i < 10 ? "0" + i : Long.toString(i);
|
||||
}
|
||||
|
||||
private static String formatWaitingTime(long time) {
|
||||
String s = atLeast2(time/60%60) + ":" + atLeast2(time%60);
|
||||
if(time >= 3600) {
|
||||
s = atLeast2(time/3600%24) + ":" + s;
|
||||
if(time >= 24*3600) {
|
||||
s = time/24/3600 + "d, " + s;
|
||||
}
|
||||
}
|
||||
return s;
|
||||
}
|
||||
}
|
@ -0,0 +1,85 @@
|
||||
package org.mibew.api;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import javax.xml.parsers.SAXParser;
|
||||
import javax.xml.parsers.SAXParserFactory;
|
||||
|
||||
import org.mibew.api.handlers.UpdateHandler;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
/**
|
||||
* @author inspirer
|
||||
*/
|
||||
public class MibewTracker {
|
||||
|
||||
private final MibewConnection fConnection;
|
||||
private final MibewTrackerListener fListener;
|
||||
private long fSince = 0;
|
||||
private long fLastUpdate = 0;
|
||||
|
||||
private final Map<Long, MibewThread> fThreads;
|
||||
|
||||
public MibewTracker(MibewConnection conn, MibewTrackerListener listener) {
|
||||
this.fConnection = conn;
|
||||
this.fListener = listener;
|
||||
this.fThreads = new HashMap<Long, MibewThread>();
|
||||
}
|
||||
|
||||
public void update() throws IOException, SAXException, ParserConfigurationException {
|
||||
MibewResponse response = fConnection.request("operator/update.php", "since=" + fSince);
|
||||
SAXParser sp = SAXParserFactory.newInstance().newSAXParser();
|
||||
UpdateHandler handler = new UpdateHandler();
|
||||
sp.parse(new ByteArrayInputStream(response.getResponse()), handler);
|
||||
handleResponse(response, handler);
|
||||
}
|
||||
|
||||
private void handleResponse(MibewResponse response, UpdateHandler handler) throws IOException {
|
||||
if (handler.getResponse() == UpdateHandler.UPD_ERROR) {
|
||||
throw new IOException("Update error: " + handler.getMessage());
|
||||
} else if (handler.getResponse() == UpdateHandler.UPD_SUCCESS) {
|
||||
fSince = handler.getRevision();
|
||||
fLastUpdate = handler.getTime();
|
||||
List<MibewThread> threads = handler.getThreads();
|
||||
if (threads != null && threads.size() > 0) {
|
||||
processUpdate(threads);
|
||||
}
|
||||
} else {
|
||||
throw new IOException("Update error: " + response.getResponseText());
|
||||
}
|
||||
}
|
||||
|
||||
private void processUpdate(List<MibewThread> updated) {
|
||||
for (MibewThread mt : updated) {
|
||||
MibewThread existing = fThreads.get(mt.getId());
|
||||
boolean isClosed = mt.getState().equals("closed");
|
||||
if (existing == null) {
|
||||
if (!isClosed) {
|
||||
fThreads.put(mt.getId(), mt);
|
||||
fListener.threadCreated(mt);
|
||||
}
|
||||
} else if (isClosed) {
|
||||
fThreads.remove(mt.getId());
|
||||
fListener.threadClosed(existing);
|
||||
} else {
|
||||
existing.updateFrom(mt);
|
||||
fListener.threadChanged(existing);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public long getLastUpdate() {
|
||||
return fLastUpdate;
|
||||
}
|
||||
|
||||
public MibewThread[] getThreads() {
|
||||
Collection<MibewThread> values = fThreads.values();
|
||||
return values.toArray(new MibewThread[values.size()]);
|
||||
}
|
||||
}
|
@ -26,6 +26,4 @@ public class Utils {
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -15,7 +15,9 @@ import org.xml.sax.helpers.DefaultHandler;
|
||||
public class UpdateHandler extends DefaultHandler {
|
||||
|
||||
public static final int UPD_ERROR = 1;
|
||||
public static final int UPD_THREADS = 2;
|
||||
public static final int UPD_SUCCESS = 2;
|
||||
|
||||
private static final int STATE_READING_THREADS = 1;
|
||||
|
||||
private int fResponse = 0;
|
||||
private String fMessage = "";
|
||||
@ -23,6 +25,8 @@ public class UpdateHandler extends DefaultHandler {
|
||||
private long fTime;
|
||||
private List<MibewThread> fUpdated;
|
||||
|
||||
private int state = 0;
|
||||
|
||||
private Stack<String> fPath = new Stack<String>();
|
||||
private MibewThread fCurrentThread;
|
||||
|
||||
@ -33,27 +37,34 @@ public class UpdateHandler extends DefaultHandler {
|
||||
if (fPath.size() == 0) {
|
||||
if (name.equals("error")) {
|
||||
fResponse = UPD_ERROR;
|
||||
} else if (name.equals("threads")) {
|
||||
fResponse = UPD_THREADS;
|
||||
fTime = Long.parseLong(attributes.getValue("time"));
|
||||
fRevision = Long.parseLong(attributes.getValue("revision"));
|
||||
} else if (name.equals("update")) {
|
||||
fResponse = UPD_SUCCESS;
|
||||
} else {
|
||||
throw new SAXException("unknown root element: " + name);
|
||||
}
|
||||
}
|
||||
if (fResponse == UPD_THREADS && fPath.size() == 1
|
||||
&& name.equals("thread")) {
|
||||
long id = Long.parseLong(attributes.getValue("id"));
|
||||
String stateid = attributes.getValue("stateid");
|
||||
fCurrentThread = new MibewThread(id, stateid);
|
||||
|
||||
if(!stateid.equals("closed")) {
|
||||
fCurrentThread.fStateText = attributes.getValue("state");
|
||||
fCurrentThread.fCanOpen = booleanAttribute(attributes.getValue("canopen"));
|
||||
fCurrentThread.fCanView = booleanAttribute(attributes.getValue("canview"));
|
||||
fCurrentThread.fCanBan = booleanAttribute(attributes.getValue("canban"));
|
||||
} else if(fResponse == UPD_SUCCESS) {
|
||||
if(fPath.size() == 1) {
|
||||
if (name.equals("threads")) {
|
||||
fTime = Long.parseLong(attributes.getValue("time"));
|
||||
fRevision = Long.parseLong(attributes.getValue("revision"));
|
||||
fUpdated = new ArrayList<MibewThread>();
|
||||
state = STATE_READING_THREADS;
|
||||
}
|
||||
/* ignore others for compatibility reasons */
|
||||
}
|
||||
if (fPath.size() == 2 && state == STATE_READING_THREADS && name.equals("thread")) {
|
||||
long id = Long.parseLong(attributes.getValue("id"));
|
||||
String stateid = attributes.getValue("stateid");
|
||||
fCurrentThread = new MibewThread(id, stateid);
|
||||
|
||||
if(!stateid.equals("closed")) {
|
||||
fCurrentThread.setStateText(attributes.getValue("state"));
|
||||
fCurrentThread.setCanOpen(booleanAttribute(attributes.getValue("canopen")));
|
||||
fCurrentThread.setCanView(booleanAttribute(attributes.getValue("canview")));
|
||||
fCurrentThread.setCanBan(booleanAttribute(attributes.getValue("canban")));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
} catch (NumberFormatException ex) {
|
||||
throw new SAXException(ex.getMessage());
|
||||
@ -68,17 +79,23 @@ public class UpdateHandler extends DefaultHandler {
|
||||
return false;
|
||||
}
|
||||
|
||||
private long longValue(String value) throws SAXException {
|
||||
try {
|
||||
return Long.parseLong(value);
|
||||
} catch(NumberFormatException ex) {
|
||||
throw new SAXException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endElement(String uri, String localName, String name)
|
||||
throws SAXException {
|
||||
fPath.pop();
|
||||
if (fResponse == UPD_THREADS && fPath.size() == 1
|
||||
&& name.equals("thread")) {
|
||||
if(fUpdated == null) {
|
||||
fUpdated = new ArrayList<MibewThread>();
|
||||
}
|
||||
if (fResponse == UPD_SUCCESS && fPath.size() == 2 && state == STATE_READING_THREADS && name.equals("thread")) {
|
||||
fUpdated.add(fCurrentThread);
|
||||
fCurrentThread = null;
|
||||
} else if(fPath.size() == 1 && state == STATE_READING_THREADS) {
|
||||
state = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -91,21 +108,26 @@ public class UpdateHandler extends DefaultHandler {
|
||||
throw new SAXException("unexpected characters");
|
||||
}
|
||||
fMessage += new String(ch, start, length);
|
||||
} else if (fResponse == UPD_THREADS) {
|
||||
if(fCurrentThread == null || fPath.size() != 3) {
|
||||
} else if (fResponse == UPD_SUCCESS && fCurrentThread != null) {
|
||||
if(fCurrentThread == null || fPath.size() != 4) {
|
||||
throw new SAXException("unknown characters");
|
||||
}
|
||||
|
||||
String subvar = fPath.peek();
|
||||
String value = new String(ch, start, length);
|
||||
if("name".equals(subvar)) {
|
||||
fCurrentThread.fClientName += value;
|
||||
fCurrentThread.setClientName(fCurrentThread.getClientName() + value);
|
||||
} else if("addr".equals(subvar)) {
|
||||
fCurrentThread.fAddress += value;
|
||||
fCurrentThread.setAddress(fCurrentThread.getAddress() + value);
|
||||
} else if("message".equals(subvar)) {
|
||||
fCurrentThread.fFirstMessage += value;
|
||||
fCurrentThread.setFirstMessage(fCurrentThread.getFirstMessage() + value);
|
||||
} else if("agent".equals(subvar)) {
|
||||
fCurrentThread.fAgent += value;
|
||||
fCurrentThread.setAgent(fCurrentThread.getAgent() + value);
|
||||
} else if("modified".equals(subvar)) {
|
||||
if(fCurrentThread.getWaitingTime() != 0) {
|
||||
throw new SAXException("error: waiting time is already set");
|
||||
}
|
||||
fCurrentThread.setWaitingTime(longValue(value) - fTime + System.currentTimeMillis());
|
||||
}
|
||||
|
||||
// TODO
|
@ -4,5 +4,6 @@
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="lib" path="libs/smack.jar"/>
|
||||
<classpathentry kind="lib" path="libs/smackx.jar"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/org.mibew.api"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
@ -0,0 +1,49 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
|
||||
<plist version="0.9">
|
||||
<dict>
|
||||
<key>CFBundleName</key>
|
||||
<string>Mibew Notifier</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>org.mibew.notifier</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>100.0</string>
|
||||
<key>CFBundleAllowMixedLocalizations</key>
|
||||
<string>true</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>MibewNotifier</string>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string>Mibew Notifier 1.0, build 17 Jan, 2010</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>mibew.icns</string>
|
||||
<key>Java</key>
|
||||
<dict>
|
||||
<key>WorkingDirectory</key>
|
||||
<string>$APP_PACKAGE/Contents/Resources/Java</string>
|
||||
<key>VMOptions</key>
|
||||
<string>-Xms16mm</string>
|
||||
<key>MainClass</key>
|
||||
<string>org.mibew.trayapp.NotifyApp</string>
|
||||
<key>JVMVersion</key>
|
||||
<string>1.6+</string>
|
||||
<key>ClassPath</key>
|
||||
<array>
|
||||
<string>$JAVAROOT/org.mibew.notifier.jar</string>
|
||||
<string>$JAVAROOT/smackx.jar</string>
|
||||
<string>$JAVAROOT/smackx-jingle.jar</string>
|
||||
<string>$JAVAROOT/smackx-debug.jar</string>
|
||||
<string>$JAVAROOT/smack.jar</string>
|
||||
</array>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
Binary file not shown.
@ -0,0 +1 @@
|
||||
APPL????
|
Binary file not shown.
61
src/mibewjava/org.mibew.jabber/resources/build.xml
Normal file
61
src/mibewjava/org.mibew.jabber/resources/build.xml
Normal file
@ -0,0 +1,61 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project basedir="." default="build" name="org.mibew.notifier">
|
||||
<property environment="env"/>
|
||||
<property name="debuglevel" value="source,lines,vars"/>
|
||||
<property name="osxJarPath" value="Mibew Notifier.app/Contents/Resources/Java"/>
|
||||
<property name="projectJar" value="org.mibew.notifier.jar"/>
|
||||
<property name="projectVersion" value="1.00"/>
|
||||
|
||||
|
||||
<target name="init">
|
||||
<mkdir dir="bin"/>
|
||||
</target>
|
||||
<target name="clean">
|
||||
<delete dir="bin"/>
|
||||
<delete file="${projectJar}"/>
|
||||
<delete>
|
||||
<fileset dir="${osxJarPath}">
|
||||
<include name="*.jar"/>
|
||||
</fileset>
|
||||
<fileset dir="."><include name="*.dmg"/></fileset>
|
||||
</delete>
|
||||
</target>
|
||||
<target depends="init" name="build">
|
||||
<echo message="${ant.project.name}: ${ant.file}"/>
|
||||
<copy includeemptydirs="false" todir="bin">
|
||||
<fileset dir="../src" excludes="**/*.java, **/*.ini"/>
|
||||
</copy>
|
||||
<javac debug="true" debuglevel="${debuglevel}" destdir="bin" source="1.6" target="1.6">
|
||||
<src path="../src"/>
|
||||
<classpath>
|
||||
<fileset dir="../libs">
|
||||
<include name="*.jar"/>
|
||||
</fileset>
|
||||
</classpath>
|
||||
</javac>
|
||||
<tstamp>
|
||||
<format property="TODAY" pattern="yyyy-MM-dd HH:mm:ss" />
|
||||
</tstamp>
|
||||
<jar destfile="${projectJar}">
|
||||
<fileset dir="bin"/>
|
||||
<manifest>
|
||||
<attribute name="Main-Class" value="org.mibew.trayapp.NotifyApp"/>
|
||||
<attribute name="Implementation-Version" value="${projectVersion}"/>
|
||||
<attribute name="Built-Date" value="${TODAY}"/>
|
||||
</manifest>
|
||||
</jar>
|
||||
</target>
|
||||
<target depends="build" name="packageOSX">
|
||||
<copy includeemptydirs="false" todir="${osxJarPath}">
|
||||
<fileset dir="../libs">
|
||||
<include name="*.jar"/>
|
||||
</fileset>
|
||||
<fileset file="${projectJar}"/>
|
||||
</copy>
|
||||
<exec executable="/Developer/Tools/SetFile">
|
||||
<arg value="-a"/>
|
||||
<arg value="B"/>
|
||||
<arg value="Mibew Notifier.app"/>
|
||||
</exec>
|
||||
</target>
|
||||
</project>
|
BIN
src/mibewjava/org.mibew.jabber/resources/images/mibew.gif
Normal file
BIN
src/mibewjava/org.mibew.jabber/resources/images/mibew.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.9 KiB |
6
src/mibewjava/org.mibew.jabber/resources/packdmg.sh
Executable file
6
src/mibewjava/org.mibew.jabber/resources/packdmg.sh
Executable file
@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
rm -rf *.dmg
|
||||
hdiutil create mibew-notifier-temp.dmg -volname "Mibew Notifier 1.0" -fs HFS+ -srcfolder "Mibew Notifier.app"
|
||||
hdiutil convert "mibew-notifier-temp.dmg" -format UDZO -imagekey zlib-level=9 -o "mibew-1.0.0.dmg"
|
||||
rm mibew-notifier-temp.dmg
|
@ -1,38 +0,0 @@
|
||||
package org.mibew.api;
|
||||
|
||||
/**
|
||||
* @author inspirer
|
||||
*/
|
||||
public class MibewThread {
|
||||
|
||||
public final long fId;
|
||||
public String fState;
|
||||
public String fClientName = "";
|
||||
public String fAgent = "";
|
||||
public String fAddress = "";
|
||||
public String fFirstMessage = "";
|
||||
public boolean fCanOpen = false;
|
||||
public boolean fCanView = false;
|
||||
public boolean fCanBan = false;
|
||||
public String fStateText;
|
||||
|
||||
public MibewThread(long id, String state) {
|
||||
fId = id;
|
||||
fState = state;
|
||||
}
|
||||
|
||||
public void updateFrom(MibewThread updated) {
|
||||
if(fId != updated.fId) {
|
||||
throw new IllegalArgumentException("different threads");
|
||||
}
|
||||
fState = updated.fState;
|
||||
fClientName = updated.fClientName;
|
||||
fAgent = updated.fAgent;
|
||||
fAddress = updated.fAddress;
|
||||
fFirstMessage = updated.fFirstMessage;
|
||||
fCanOpen = updated.fCanOpen;
|
||||
fCanView = updated.fCanView;
|
||||
fCanBan = updated.fCanBan;
|
||||
fStateText = updated.fStateText;
|
||||
}
|
||||
}
|
@ -1,85 +0,0 @@
|
||||
package org.mibew.api;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.xml.parsers.SAXParser;
|
||||
import javax.xml.parsers.SAXParserFactory;
|
||||
|
||||
import org.mibew.api.handlers.UpdateHandler;
|
||||
|
||||
/**
|
||||
* @author inspirer
|
||||
*/
|
||||
public class MibewTracker {
|
||||
|
||||
private final MibewConnection fConnection;
|
||||
private final MibewTrackerListener fListener;
|
||||
private long fSince = 0;
|
||||
private long fLastUpdate = 0;
|
||||
|
||||
private final Map<Long,MibewThread> fThreads;
|
||||
|
||||
public MibewTracker(MibewConnection conn, MibewTrackerListener listener) {
|
||||
this.fConnection = conn;
|
||||
this.fListener = listener;
|
||||
this.fThreads = new HashMap<Long, MibewThread>();
|
||||
}
|
||||
|
||||
public void track() throws InterruptedException {
|
||||
for(int i = 0; i < 5; i++) {
|
||||
try {
|
||||
MibewResponse response = fConnection.request("operator/update.php", "since="+fSince);
|
||||
SAXParser sp = SAXParserFactory.newInstance().newSAXParser();
|
||||
UpdateHandler handler = new UpdateHandler();
|
||||
sp.parse(new ByteArrayInputStream(response.getResponse()), handler);
|
||||
handleResponse(response, handler);
|
||||
} catch(Exception e) {
|
||||
System.err.println("update exception: " + e.getMessage());
|
||||
}
|
||||
Thread.sleep(1000);
|
||||
}
|
||||
}
|
||||
|
||||
private void handleResponse(MibewResponse response, UpdateHandler handler) {
|
||||
if(handler.getResponse() == UpdateHandler.UPD_ERROR) {
|
||||
System.out.println("Update error: " + handler.getMessage());
|
||||
} else if(handler.getResponse() == UpdateHandler.UPD_THREADS) {
|
||||
System.out.println("Updated.... " + handler.getRevision());
|
||||
fSince = handler.getRevision();
|
||||
fLastUpdate = handler.getTime();
|
||||
List<MibewThread> threads = handler.getThreads();
|
||||
if(threads != null && threads.size() > 0) {
|
||||
processUpdate(threads);
|
||||
}
|
||||
} else {
|
||||
System.out.println("Update error");
|
||||
System.out.println(response.getResponseText());
|
||||
}
|
||||
}
|
||||
|
||||
private void processUpdate(List<MibewThread> updated) {
|
||||
for(MibewThread mt : updated) {
|
||||
MibewThread existing = fThreads.get(mt.fId);
|
||||
boolean isClosed = mt.fState.equals("closed");
|
||||
if(existing == null) {
|
||||
if(!isClosed) {
|
||||
fThreads.put(mt.fId, mt);
|
||||
fListener.threadCreated(mt);
|
||||
}
|
||||
} else if(isClosed) {
|
||||
fThreads.remove(mt.fId);
|
||||
fListener.threadClosed(existing);
|
||||
} else {
|
||||
existing.updateFrom(mt);
|
||||
fListener.threadChanged(existing);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public long getLastUpdate() {
|
||||
return fLastUpdate;
|
||||
}
|
||||
}
|
@ -39,7 +39,7 @@ public class Application {
|
||||
}
|
||||
});
|
||||
|
||||
MibewConnection conn = new MibewConnection("http://localhost:8080/webim/", "admin", "");
|
||||
MibewConnection conn = new MibewConnection("http://localhost:8080/webim/", "admin", "1");
|
||||
if(!conn.connect()) {
|
||||
System.err.println("Wrong server, login or password.");
|
||||
return;
|
||||
@ -49,14 +49,14 @@ public class Application {
|
||||
@Override
|
||||
public void threadCreated(MibewThread thread) {
|
||||
try {
|
||||
chat.sendMessage(thread.fId + ": " + thread.fAddress + " " + thread.fClientName);
|
||||
chat.sendMessage(thread.getId() + ": " + thread.getAddress() + " " + thread.getClientName());
|
||||
} catch (XMPPException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
mt.track();
|
||||
//mt.track();
|
||||
|
||||
connection.disconnect();
|
||||
}
|
||||
|
8
src/mibewjava/org.mibew.notifier/.classpath
Normal file
8
src/mibewjava/org.mibew.notifier/.classpath
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/org.mibew.api"/>
|
||||
<classpathentry kind="lib" path="libs/swt-debug.jar" sourcepath="libs/src.zip"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
17
src/mibewjava/org.mibew.notifier/.project
Normal file
17
src/mibewjava/org.mibew.notifier/.project
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>org.mibew.notifier</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
BIN
src/mibewjava/org.mibew.notifier/libs/src.zip
Normal file
BIN
src/mibewjava/org.mibew.notifier/libs/src.zip
Normal file
Binary file not shown.
BIN
src/mibewjava/org.mibew.notifier/libs/swt-debug.jar
Normal file
BIN
src/mibewjava/org.mibew.notifier/libs/swt-debug.jar
Normal file
Binary file not shown.
BIN
src/mibewjava/org.mibew.notifier/libs/swt.jar
Normal file
BIN
src/mibewjava/org.mibew.notifier/libs/swt.jar
Normal file
Binary file not shown.
15
src/mibewjava/org.mibew.notifier/org.mibew.notifier.iml
Normal file
15
src/mibewjava/org.mibew.notifier/org.mibew.notifier.iml
Normal file
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="false">
|
||||
<output url="file://$MODULE_DIR$/bin" />
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module" module-name="org.mibew.api" />
|
||||
<orderEntry type="library" name="swt" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
|
5
src/mibewjava/org.mibew.notifier/src/mibew.ini
Normal file
5
src/mibewjava/org.mibew.notifier/src/mibew.ini
Normal file
@ -0,0 +1,5 @@
|
||||
# Mibew parameters
|
||||
|
||||
mibew.host=http://localhost:8080/webim/
|
||||
mibew.login=admin
|
||||
mibew.password=
|
@ -0,0 +1,42 @@
|
||||
package org.mibew.notifier;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Arrays;
|
||||
|
||||
public class BrowserUtil {
|
||||
|
||||
static final String[] browsers = { "firefox", "opera", "konqueror", "epiphany", "seamonkey", "galeon",
|
||||
"kazehakase", "mozilla", "netscape" };
|
||||
|
||||
/**
|
||||
* Bare Bones Browser Launch
|
||||
* Version 2.0 (May 26, 2009)
|
||||
* By Dem Pilafian
|
||||
* @param url
|
||||
*/
|
||||
public static void openURL(String url) throws IOException {
|
||||
String osName = System.getProperty("os.name");
|
||||
try {
|
||||
if (osName.startsWith("Mac OS")) {
|
||||
Class<?> fileMgr = Class.forName("com.apple.eio.FileManager");
|
||||
Method openURL = fileMgr.getDeclaredMethod("openURL", new Class[] { String.class });
|
||||
openURL.invoke(null, new Object[] { url });
|
||||
} else if (osName.startsWith("Windows")) {
|
||||
Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + url);
|
||||
} else { // assume Unix or Linux
|
||||
boolean found = false;
|
||||
for (String browser : browsers)
|
||||
if (!found) {
|
||||
found = Runtime.getRuntime().exec(new String[] { "which", browser }).waitFor() == 0;
|
||||
if (found)
|
||||
Runtime.getRuntime().exec(new String[] { browser, url });
|
||||
}
|
||||
if (!found)
|
||||
throw new Exception(Arrays.toString(browsers));
|
||||
}
|
||||
} catch (Throwable th) {
|
||||
throw new IOException("Error attempting to launch web browser\n" + th.toString());
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package org.mibew.notifier;
|
||||
|
||||
import org.mibew.api.MibewAgent;
|
||||
import org.mibew.api.MibewAgentListener;
|
||||
|
||||
public class ConsoleApp {
|
||||
|
||||
public static void main(String[] args) {
|
||||
Options options = new Options(args);
|
||||
if(!options.load()) {
|
||||
return;
|
||||
}
|
||||
|
||||
MibewAgent agent = new MibewAgent(options.getAgentOptions(), new MibewAgentListener() {
|
||||
@Override
|
||||
protected void onlineStateChanged(boolean isOnline) {
|
||||
System.out.println("now " + (isOnline ? "online" : "offline"));
|
||||
}
|
||||
});
|
||||
agent.launch();
|
||||
try {
|
||||
Thread.sleep(3500);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
|
||||
agent.stop();
|
||||
}
|
||||
}
|
@ -0,0 +1,140 @@
|
||||
package org.mibew.notifier;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.graphics.Image;
|
||||
import org.eclipse.swt.widgets.*;
|
||||
import org.eclipse.swt.widgets.Event;
|
||||
import org.eclipse.swt.widgets.Menu;
|
||||
import org.eclipse.swt.widgets.MenuItem;
|
||||
import org.mibew.api.MibewAgent;
|
||||
import org.mibew.api.MibewAgentListener;
|
||||
import org.mibew.api.MibewThread;
|
||||
|
||||
import java.awt.*;
|
||||
import java.io.IOException;
|
||||
|
||||
public class MibewTray extends MibewAgentListener {
|
||||
|
||||
private volatile boolean isStopped = false;
|
||||
|
||||
private Image fImageOn;
|
||||
private Image fImageOff;
|
||||
private TrayItem fItem;
|
||||
private Menu fMenu;
|
||||
private MibewAgent fAgent;
|
||||
|
||||
void initTray(Display display, Shell shell, MibewAgent agent) {
|
||||
fAgent = agent;
|
||||
fImageOn = new Image(display, getClass().getClassLoader().getResourceAsStream("org/mibew/notifier/tray_on.png"));
|
||||
fImageOff = new Image(display, getClass().getClassLoader().getResourceAsStream("org/mibew/notifier/tray_off.png"));
|
||||
|
||||
final Tray tray = display.getSystemTray();
|
||||
if (tray == null) {
|
||||
System.out.println("The system tray is not available");
|
||||
} else {
|
||||
fItem = new TrayItem(tray, SWT.NONE);
|
||||
fItem.setToolTipText("SWT TrayItem");
|
||||
fItem.addListener(SWT.Show, new Listener() {
|
||||
public void handleEvent(Event event) {
|
||||
System.out.println("show");
|
||||
}
|
||||
});
|
||||
fItem.addListener(SWT.Hide, new Listener() {
|
||||
public void handleEvent(Event event) {
|
||||
System.out.println("hide");
|
||||
}
|
||||
});
|
||||
fMenu = new Menu(shell, SWT.POP_UP);
|
||||
for (int i = 0; i < 8; i++) {
|
||||
MenuItem mi = new MenuItem(fMenu, SWT.PUSH);
|
||||
mi.setText("Item" + i);
|
||||
mi.addListener(SWT.Selection, new Listener() {
|
||||
public void handleEvent(Event event) {
|
||||
System.out.println("selection " + event.widget);
|
||||
}
|
||||
});
|
||||
}
|
||||
Listener listener = new Listener() {
|
||||
public void handleEvent(Event event) {
|
||||
fMenu.setVisible(true);
|
||||
}
|
||||
};
|
||||
fItem.addListener(SWT.MenuDetect, listener);
|
||||
fItem.addListener(SWT.Selection, listener);
|
||||
fItem.setImage(fImageOff);
|
||||
}
|
||||
shell.setBounds(50, 50, 300, 200);
|
||||
//shell.open();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected synchronized void onlineStateChanged(final boolean isOnline) {
|
||||
if(isStopped)
|
||||
return;
|
||||
|
||||
Display.getDefault().asyncExec(new Runnable() {
|
||||
public void run() {
|
||||
if(isStopped)
|
||||
return;
|
||||
|
||||
fItem.setImage(isOnline ? fImageOn : fImageOff);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected synchronized void updated(final MibewThread[] all, final MibewThread[] created) {
|
||||
if(isStopped)
|
||||
return;
|
||||
|
||||
Display.getDefault().asyncExec(new Runnable() {
|
||||
public void run() {
|
||||
if(isStopped)
|
||||
return;
|
||||
|
||||
for (MenuItem menuItem : fMenu.getItems()) {
|
||||
menuItem.dispose();
|
||||
}
|
||||
for(MibewThread m : all) {
|
||||
MenuItem mi = new MenuItem(fMenu, SWT.PUSH);
|
||||
mi.setText(m.getClientName());
|
||||
mi.addListener(SWT.Selection, new LinkActionListener(null, fAgent.getOptions().getUrl() + "operator/agent.php?thread=" + m.getId()));
|
||||
}
|
||||
|
||||
if(created.length == 1) {
|
||||
fItem.setToolTipText(created[0].getClientName() + "\n" + created[0].getFirstMessage());
|
||||
} else if(created.length > 1) {
|
||||
fItem.setToolTipText("New " + created.length + " visitors");
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
synchronized void dispose() {
|
||||
isStopped = true;
|
||||
fItem.dispose();
|
||||
fImageOn.dispose();
|
||||
fImageOff.dispose();
|
||||
}
|
||||
|
||||
private static class LinkActionListener implements Listener {
|
||||
private final Shell shell;
|
||||
private final String link;
|
||||
|
||||
public LinkActionListener(Shell shell, String link) {
|
||||
this.shell = shell;
|
||||
this.link = link;
|
||||
}
|
||||
|
||||
public void handleEvent(Event event) {
|
||||
try {
|
||||
BrowserUtil.openURL(link);
|
||||
} catch (IOException e1) {
|
||||
MessageBox messageBox = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
|
||||
messageBox.setText("Browser error"); //$NON-NLS-1$
|
||||
messageBox.setMessage(e1.getMessage());
|
||||
messageBox.open();
|
||||
}
|
||||
}
|
||||
}}
|
@ -0,0 +1,34 @@
|
||||
package org.mibew.notifier;
|
||||
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.mibew.api.MibewAgent;
|
||||
import org.mibew.notifier.Options.JOptions;
|
||||
|
||||
public class NotifyApp {
|
||||
|
||||
public static void main(String[] args) {
|
||||
Display display = new Display();
|
||||
Shell shell = new Shell(display);
|
||||
|
||||
Options options = new JOptions(shell, args);
|
||||
if (!options.load()) {
|
||||
return;
|
||||
}
|
||||
|
||||
MibewTray tray = new MibewTray();
|
||||
MibewAgent agent = new MibewAgent(options.getAgentOptions(), tray);
|
||||
agent.launch();
|
||||
|
||||
tray.initTray(display, shell, agent);
|
||||
|
||||
while (!shell.isDisposed()) {
|
||||
if (!display.readAndDispatch())
|
||||
display.sleep();
|
||||
}
|
||||
tray.dispose();
|
||||
agent.stop();
|
||||
display.dispose();
|
||||
System.exit(0);
|
||||
}
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
package org.mibew.notifier;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.widgets.MessageBox;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.mibew.api.MibewAgentOptions;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Properties;
|
||||
|
||||
public class Options {
|
||||
|
||||
private MibewAgentOptions agentOptions;
|
||||
private Properties myProperties;
|
||||
|
||||
public Options(String[] args) {
|
||||
}
|
||||
|
||||
public boolean load() {
|
||||
try {
|
||||
InputStream is = getClass().getClassLoader().getResourceAsStream("mibew.ini");
|
||||
if (is != null) {
|
||||
myProperties = new Properties();
|
||||
myProperties.load(is);
|
||||
agentOptions = MibewAgentOptions.create(myProperties);
|
||||
return true;
|
||||
} else {
|
||||
handleError("cannot find mibew.ini");
|
||||
}
|
||||
} catch (IOException e) {
|
||||
handleError(e.getMessage());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void handleError(String message) {
|
||||
System.err.println(message);
|
||||
}
|
||||
|
||||
public MibewAgentOptions getAgentOptions() {
|
||||
return agentOptions;
|
||||
}
|
||||
|
||||
public static class JOptions extends Options {
|
||||
|
||||
private final Shell fShell;
|
||||
|
||||
public JOptions(Shell shell, String[] args) {
|
||||
super(args);
|
||||
fShell = shell;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleError(final String message) {
|
||||
MessageBox messageBox = new MessageBox(fShell, SWT.OK | SWT.ICON_ERROR);
|
||||
messageBox.setText("Options error"); //$NON-NLS-1$
|
||||
messageBox.setMessage(message);
|
||||
messageBox.open();
|
||||
}
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 2.1 KiB |
Binary file not shown.
After Width: | Height: | Size: 2.0 KiB |
Loading…
Reference in New Issue
Block a user