powered by Jive Software

Helga (a Server-Bot plugin)


#1

Helga is a powerful Server-Bot. It can be controlled by normal chat messages you send to bot@helga.yourserver.com, helga.yourserver.com or generally something@helga.yourserver.com. You will be automatically registered if you add Helga to your roster. Alternatively you can register via service discovery.

requirements and license

  • Openfire 3.5.x, 3.6.0 or newer
  • MySQL database is fully supported. Microsoft SQL-Server and HSQLDB (embedded-db) databases are reported to work, too. All other databases supported by Openfire are still beta, because completely untested.
  • released under GNU General Public License
  • I use parts of official plugins ( presence and search ) and Openfire itself. I am not the owner of the complete copyright, so I can’t release it under any other license for you.

key features

  • advanced shared groups (see below)
  • LaTeX interface: compile LaTeX code into images, using external application.
  • some nice admin commands (e.g. message or email to every registered user, …)
  • send remind messages to yourself or other users, simple management of this messages
  • import/export your own roster, import nicknames names from vCards (does work with transports, too!)
  • features taken from presence plugin: provide users presence via HTTP-Request, this does only work if the affected user has explicit allowed this.
  • currently available in German and an (maybe bad) English translation. (it would be great if a native English speaking could help translating it)
  • for developers
    • English comments and identifiers in source code (use of JavaDoc)
    • use of i18n files, you can translate Helga in your language
    • use of Openfire’s internal database schema manager
    • easy to use base class for commands
    • feature rich utility classes
    • event system, to realize timeouts, callbacks, etc.
    • it should be easy to extend Helga with your ideas!

helga shared groups

Helga builds an advanced shared group system around the constricted Openfire system. So everything that was possible with Openfire itself, is possible with Helga, too. A more detailed description is available in German language.

  • All group settings are available through Helga chat commands. This should work with ALL jabber clients.
  • different user classes:
    • everyone - just a user who has an account on your server
    • group member - user who is member of a group
    • moderator - moderators for example can kick or ban users. Only serveradmins can give you this rights.
    • serveradmin - member of special group “Jabber Admins”, this users can do everything
  • different group types:
    • OPEN - everyone can join this group or invite others. Moderators can kick or ban users. The list of group members is public and the group appears in global group list.
    • MODERATED - everyone can request a join, moderators can accept their request, invite, kick or ban users. The list of group moderators is public, member list is visible for members. The group appears in global group list.
    • CLOSED - users can only join this group, if they got an invitation from a moderator before. Moderators can kick or ban users, too. The list of group moderators is public, member list is visible for members. The group does not appear on global group list.

commands

An complete manual to all commands and parameters is currently only available in German language. Also a first steps guide is available in German.

basic commands

command

description

help

Get a list of all supported commands.

help [command]

Get help to an specific command.

get

Reads out the current setting of an option. To change a setting, use the ‘set’-command.

latex

Complies given LaTeX Code to an GIF image, uploaded on the server. Helga provides two links:

  • permanent link to the image

  • always the same link which points always onto your last image.

See README for more details.

message

Send a remind message to someone. This command can be used to send an message to yourself or someone else. You can manage your messages with ‘show’ and ‘remove’ commands. The number of messages per user is limited to 10.

ping

Simple command which just answers “pong”. Helpful to check if your internet connection is still available.

presence

Gives the time when an user was last seen or his presence if the user is only at the moment. For security reasons is is only possible to query users who are registered with Helga and have set public setting to ‘true’.

Serveradmins get extended information about users operating system and client.

remove

Active events can be removed. The ‘remove’-Command removes an specific or all messages. You can only remove your own messages. You can get the MessageID by the ‘show’-Command.

set

Set an option to an new value. To read out the current setting use the ‘get’-command.

show

Prints a list of all your active messages.

time

Sends current servertime

welcome

Sends welcome-message again.

group management

command

description

group add

This command is only for serveradmins. You can add one ore more users directly to a group. (without user demand)

group ban

This command is only for moderators. The user will deleted from the group and append to a ban list, which prevents the user from rejoin to the group. The ban can be revoked with the ‘revoke’ command. This ban list of a group can be shown using the ‘info’ command.

group create

Serveradmins can create new groups with this command. To change group settings later, use ‘update’. Both commands are identically, except that ‘create’ can only create new groups and ‘update’ can only change existing groups. (security against typos)

group decline

This command has two functions:

  1. You can decline an invitation explicitly. Moderators will noticed about this with a message.

  2. Moderators can decline a join request.

group delete

Serveradmins can delete existing groups.

group find

This command lists all available groups of type OPEN and MODERATED. Groups of type CLOSED are only showed to serveradmins.

An optional filter can be used to restrict the search. All groups are listed who have the given filter in their name. The wildcards * and ? are interpreted as usual. The filter is case sensitive.

group info

A list of groups you are member of or information to an specific group.

group invite

Inside of OPEN groups every member can send invitations. Inside of MODERATED or CLOSED group only moderators are allowed to do this. Make an user an join request, then all moderators will receive a message. By inviting this user a moderator can accept the request. In this case the user will not receive an invite message, but will added to the group directly.

group join

With this command you can join a group. If the group is MODERATED, only a join request is made. This request can be accepted by an moderator with an ‘invite’ or decline with ‘decline’. In CLOSED groups you can only join if you have been invited.

Only serveradmins can ‘join’ other users.

group kick

Groupmembers can leave the group with this command. Moderators can kick other users out of the group.

group message

Send a message to all members of a group. Only for group members in case of the group is in ONLYGROUP mode. In all other cases this can only done by group moderators.

group revoke

This command is only for moderators. It revokes a ban that was declared using the ‘ban’ command.

group update

see ‘create’

roster management

command

description

roster import

With this command you can add multiple contacts at once to your roster (contactlist). This only makes sence if you want to import many contacts, for example a complete contact list if you are doing a server relocation.

roster export

This command does export your roster (contactlist) using the format described under ‘import’. Contacts form shared groups where exported, too. Contacts that have a jabberID without a username (e.g. Transports as icq.jabber.rwth-aachen.de) where not exported.

roster names

This command iterates through your complete roster and sets nicknames automatically. This could take some seconds, especially if vCard are not locally available and have to be requested from remote.

admin commands

command

description

admin email

Serveradmins can send an email to all users of your server.

admin message

Serveradmins can send a message to all registered users of your server. (really all users, not only available)

changelog

2.22 – August 18, 2008

  • Fixed bugs in database scripts for hsqldb. Using HSQLDB (embedded-db) with Helga should work now. (thx @ dfaure)

  • Changed time format for locale EN to 24h clock for usability reasons.

  • Fixed time format bug in ‘message’ command manpage.

  • Fixed minor leap year bug in ‘message’ command.

  • New compile script: No longer hardcoded absolute paths. JavaDoc creation should no longer flood with warnings.
    2.21 – April 8, 2008

  • Applied API changes for Openfire 3.5.0. Set minServerVersion to 3.5.0

  • Fixed some bad quoting bugs in i18n files.

  • Fixed NullPointerException for commands ‘group create’ and ‘group update’ if parameter ‘-g’ is not given.

  • Fixed NullPointerException when revoking moderator rights with command ‘group update’.

  • command ‘presence’ does now show also group memberships, if an admin is querying.

2.20 – March 13, 2008

  • new command: ‘latex’ - compiles LaTeX code to images, using an external application.

2.11 – March 4, 2008

  • Fixed serveral problems with SQL-server database. SQL-server should work now, but helga’s group features are still untested with SQL-server. thx@deafsquad

  • Other databases than MySQL and SQL-server are still Beta. Would be nice if someone could test it and report results to me.

  • Added some linebreaks to in-band-registration-instructions.

2.1 – February 21, 2008

  • ‘message’ command does now check if a local resource is available before sending to it. If the resource is unavailable it redirects to bare JID. For external resources can’t checked if they are available, so message were lost, if the external server does not redirect the message.

  • fixed small bug while loading message events from database

  • ‘admin message’ sends to all connected resources now, not only to the most available resource of each user. Added option not to send to unavailable users, too. This should be equivalent to send a message through the admin console.

  • new command: ‘ping’ - It just answers “pong”. Helpful to check you Internet connection.

  • new alias: (date -> time)

  • removed experimental transport settings, because they didn’t work and are not needed anymore. Removed HelgaTransportManager class and related code.

  • Helga should now be able to import nicknames from everything that supports vCards (XEP-0054 vcard-temp). In particular this should work with pyICQt and pyMSNt.

  • command: ‘roster names’, added an option to restrict work on an specific domain or subdomain.

  • massive changes on database tables. Helga should now support all databases that openfire supports, but everything else than MySQL is still Beta.

  • Helga is now integrated into Openfires database update system. In future database changes can be done automatically. If you are updating from Helga 2.1x execute the following SQL statement before updating to a newer version of Helga:

> INSERT INTO jiveVersion (name, version) VALUES ('helga', 0);
  • If you are updating from 1.xx (before offical release), you have to update manually.

2.02 – November 18, 2007

  • compiled with Openfire 3.4.1 and JDK 6u3

  • minor changes

2.01 – November 2, 2007

  • nicer presence images, images taken from Psi’s “Crystal (Roster)” Icons (Author: Everaldo Coelho, http://www.everaldo.com)

  • changed the way how Helga loads the presence images

  • now an local username is accepted in a HTTP-Request. You can use something like: *…helga/user?jid=user1 *instead of *…*helga/user?jid=user1@yourserver.com

download

This complete bundle contains: compiled jar-file, source code, JavaDoc files, some scripts and GPL license text.

helga-2.22-415.tar.gz

You should read the configuration section in README file before using!

Do not use on productive systems, if you do not have an MySQL database!

  • older releases

  • German project site

If you have questions, improvements, etc. leave a comment on this document.

Martin Weusten (Coolcat)


#2

That’s COOLcat Martin!

I use parts of official plugins ( presence and search ) and openfire itself. I am not owner of the complete copyright, so I can’t release it under an other license for you.

Everybody uses some other people’s code. It’s your idea that matters more, not just extra codes of yours. In fact, your plugin is much more than just a Precence or Search plugin. Therefore, I think you deserve to own the copyright. You could just give credit to the owner of the parts you copy and paste, like you did in Helga.java:

This plugin is based on the Presence-Plugin from Gaston Dombiak and the Search-Plugin from Ryan Graham, but is nearly completly rewriten.

Also, you can release it under a compatible license like Apache License version 2.0.


#3

currently nobody needs another license, so let us think about if the problem is there.

If somebody needs a translation of the complete command reference or other Helga related articles, just ask for it. But I think most things are self-explanatory, if not try Google Translate.


#4

Hi,

I am trying to test out this bot but I cannot get it to install properly. I can get the plugin installed have created the properties. I see the database tables have been created by the plugin. However, when I try to add helga to my rosta I am told it is pending. The instructions on how to install and check/test is not so clear to me.

Is there anything I have missed? How do I check Helga is actually installed correctly and running? Do I need to create an actual jabber user called ‘helga’?

Please advise.

Regards,

Mon


#5

I am trying to test out this bot but I cannot get it to install properly.

You have checked requirements? (Openfire 3.3.2, MySQL database)

Do you find Helga on your plugins page? ( https://yourserver.com:9091/plugin-admin.jsp )

Do you see Helga-Config-Help-Page? ( https://yourserver.com:9091/plugins/helga/helga.jsp )

Any related error/warn/info messages? There should be like “Helga : start()” in ‘info.log’.

I can get the plugin installed have created the properties.

You have only to create properties if you want to overwrite default settings. That should not be necessary just for testing.

How do I check Helga is actually installed correctly and running?

For example send a message with “help” to ‘bot@helga.yourserver.com’. You should get a list of all commands. It is not necessary to have Helga actually on your contact list.

Helga does only react to LOCAL users.

Do I need to create an actual jabber user called ‘helga’?

No, it’s a component. It does listen on ‘everything@helga.yourserver.com’, not as a normal user on ‘helga@yourserver.com’.

Is there anything I have missed?

For testing it should be enough to copy it into your plugins directory.

If nothing works, try to restart the plugin.

Coolcat


#6

I tried to put helga into my plugins directory. I can see the helga on my https://yourserver.com:9091/plugin-admin.jsp. But, there are so many errors, such as “IF”… bla…bla…bla… my purpose just for testing.

Do i need to create bot@helga.yourserver.com ?

sosys


#7

This is the error message :

java.sql.SQLException: Incorrect syntax near the keyword ‘IF’.

at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:365)

at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2781)

at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2224)

at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:628)

at net.sourceforge.jtds.jdbc.JtdsStatement.processResults(JtdsStatement.java:525)

at net.sourceforge.jtds.jdbc.JtdsStatement.executeSQL(JtdsStatement.java:487)

at net.sourceforge.jtds.jdbc.JtdsPreparedStatement.executeUpdate(JtdsPreparedState ment.java:421)

at org.jivesoftware.openfire.plugin.helga.HelgaUserManager.loadUsers(HelgaUserMana ger.java:518)

at org.jivesoftware.openfire.plugin.helga.HelgaUserManager.init(HelgaUserManager.j ava:153)

at org.jivesoftware.openfire.plugin.Helga.initialize(Helga.java:137)

at org.jivesoftware.openfire.component.InternalComponentManager.addComponent(Inter nalComponentManager.java:119)

at org.jivesoftware.openfire.plugin.Helga.initializePlugin(Helga.java:87)

at org.jivesoftware.openfire.container.PluginManager.loadPlugin(PluginManager.java :404)

at org.jivesoftware.openfire.container.PluginManager.access$200(PluginManager.java :46)

at org.jivesoftware.openfire.container.PluginManager$PluginMonitor.run(PluginManag er.java:916)

at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)

at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)

at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101 (ScheduledThreadPoolExecutor.java:98)

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodi c(ScheduledThreadPoolExecutor.java:181)

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Schedu ledThreadPoolExecutor.java:205)

at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java: 885)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)

at java.lang.Thread.run(Thread.java:619)

java.sql.SQLException: Incorrect syntax near the keyword ‘IF’.

at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:365)

at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2781)

at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2224)

at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:628)

at net.sourceforge.jtds.jdbc.JtdsStatement.processResults(JtdsStatement.java:525)

at net.sourceforge.jtds.jdbc.JtdsStatement.executeSQL(JtdsStatement.java:487)

at net.sourceforge.jtds.jdbc.JtdsPreparedStatement.executeUpdate(JtdsPreparedState ment.java:421)

at org.jivesoftware.openfire.plugin.helga.HelgaEventManager.loadFromDB(HelgaEventM anager.java:369)

at org.jivesoftware.openfire.plugin.helga.HelgaEventManager.init(HelgaEventManager .java:111)

at org.jivesoftware.openfire.plugin.Helga.initialize(Helga.java:138)

at org.jivesoftware.openfire.component.InternalComponentManager.addComponent(Inter nalComponentManager.java:119)

at org.jivesoftware.openfire.plugin.Helga.initializePlugin(Helga.java:87)

at org.jivesoftware.openfire.container.PluginManager.loadPlugin(PluginManager.java :404)

at org.jivesoftware.openfire.container.PluginManager.access$200(PluginManager.java :46)

at org.jivesoftware.openfire.container.PluginManager$PluginMonitor.run(PluginManag er.java:916)

at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)

at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)

at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101 (ScheduledThreadPoolExecutor.java:98)

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodi c(ScheduledThreadPoolExecutor.java:181)

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Schedu ledThreadPoolExecutor.java:205)

at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java: 885)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)

at java.lang.Thread.run(Thread.java:619)

org.xmpp.component.ComponentException: java.lang.NullPointerException

at org.jivesoftware.openfire.component.InternalComponentManager.addComponent(Inter nalComponentManager.java:144)

at org.jivesoftware.openfire.plugin.Helga.initializePlugin(Helga.java:87)

at org.jivesoftware.openfire.container.PluginManager.loadPlugin(PluginManager.java :404)

at org.jivesoftware.openfire.container.PluginManager.access$200(PluginManager.java :46)

at org.jivesoftware.openfire.container.PluginManager$PluginMonitor.run(PluginManag er.java:916)

at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)

at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)

at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101 (ScheduledThreadPoolExecutor.java:98)

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodi c(ScheduledThreadPoolExecutor.java:181)

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Schedu ledThreadPoolExecutor.java:205)

at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java: 885)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)

at java.lang.Thread.run(Thread.java:619)

Caused by: java.lang.NullPointerException

at org.jivesoftware.openfire.plugin.helga.HelgaEventManager.loadFromDB(HelgaEventM anager.java:465)

at org.jivesoftware.openfire.plugin.helga.HelgaEventManager.init(HelgaEventManager .java:111)

at org.jivesoftware.openfire.plugin.Helga.initialize(Helga.java:138)

at org.jivesoftware.openfire.component.InternalComponentManager.addComponent(Inter nalComponentManager.java:119)

… 13 more

Line=19 The content of element type “dwr” must match “(init?,allow?,signatures?)”.


#8

Do i need to create bot@helga.yourserver.com ?

No, you don’t. It’s just a virtual JID. Helga grips simply everthing that goes to *@helga.yourserver.com

In your error message I can see you don’t use a MySQL-database. Please read system requirements:

your Openfire must be backed by a MySQL database

It should not be that hard to patch Helga, so it works with other databases. I’m not familiar with other databases, so I won’t do it until I need it for myself. But for exactly such reasons Helga is open-source so, have fun to patch it yourself.


#9

Any clue for changing to MS SQL server?


#10

Hi Coolcat,

I have installed the helga successfully in my new openfire server. But, how to type the commands ? I have no idea.

Thanks


#11

Any clue for changing to MS SQL server?

I only know MySQL, but SQL is a standard language for for databases. There should only be some datatypes which are not supported. I think BIGINT and BOOL are MySQL only, just substitute them with something else which works for you. E.g. you could replace BIGINT by String and BOOL by an INT which is 0 or 1. You will have to change it at every place where the database is accessed.

But, how to type the commands ? I have no idea.

Just register with Helga. This can be done in two ways:

  • Add the JID ‘bot@helga.yourserver.com’ to your contact list as it would be a normal contact.

  • Register with Helga using Service Discovery. Then the JID ‘helga.yourserver.com’ will be added to your contact list in the Agent/Transport section.

After that just write the commands as normal chat messages.


#12

Hi Coolcat,

thanks for the reply. It runs okay on MySQL. But i have another question. I cant create group. It’s said that im not the admin, but im log in as ‘admin’.

Pls help.

benny,


#13

How to create the helga.jar after i have modified the code?

Many Thanks,

Benny


#14

Just read the documentation…

You should read the configuration section in README file before using!

Create a normal group with name “Jabber Admins” via Adminconsole and add yourself to this group. Only Members of this special group have admin rights for Helga. The group should be CLOSED, so call

group update -g “Jabber Admins” -t closed

After that you should update existing groups, so there are integrated into the Helga group system. Call this for each group that was created via adminconsole:

group update -g “Groupname”

There is another special group “New Users”, just read configuration section in README.

Coolcat


#15

You have to compile it. You will need an “JDK” (Java Development Kit) and an installed “Ant Build Tool”. Just see here and here.


#16

Thanks for your kind reply. May i know any other bots/plugin that works like Alice bot?

Sosys-


#17

Hi Coolcat,

Where is the file to connect to mysql database? I cant find it for hours.

Is it auto connected to the mysql ?

Thanks

Sosys~


#18

Where do you store the list of answers such as :

Hi,

my name is Helga!

I’am the really stupid bot on this great Jabber-Server. You can control me with normal chat messages. Send me ‘help’ to get an commandlist or 'help ’ for specific help.

I cant find it on the files.

Thanks


#19
  1. Sorry, I don’t know Alice-Bot

  2. Helga uses openfires database connection. During first start it creates some new tables with prefix “helga”.

  3. Helga uses i18n to support multiple languages:

helga/src/i18n/helga_i18n.properties (English)

helga/src/i18n/helga_i18n_de.properties (German)

If you want to implement new commands, take a look on that “Command” base class. For some simple usage examples take class “CommandMisc”.


#20

Helga 2.02-203 released.