Helga (a Server-Bot plugin)

Hey Guys,

I have been trying to import Helga into Eclipse to look at and edit the code, But i have been having trouble with it regards missing class files, errors and library’s. Has anybody done this and whats the best way of doing it.

its ok now got it sorted

Helga 2.1-321 released.

i just tried to install helga on openfire 3.4.4 with sql-server backend. first problem is that you can not use the word “public” as a fieldname in table helgauser. you also can not use the same constraint twice on sql-server. somehow i created the tables but i see following errorlogs

at

org.jivesoftware.openfire.plugin.helga.HelgaEventManager.loadFromDB(HelgaEventMa nager.java:350)

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

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

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

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

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

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

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

i’m no programmer but i would help to test/develop the bot for MS-Sql support

thx for testing

I changed column name form ‘public’ to ‘presence’ and renamed the constraints.

helga-2.1-325.tar.gz

Please execute this SQL before trying the new version to be sure your database is “clean” again:

DROP TABLE helgaEvent;
DROP TABLE helgaMessage;
DROP TABLE helgaUser;
DROP TABLE helgaGroup;
DELETE FROM jiveVersion WHERE name='helga';

P.S. Currently there is only an upgrade file for MySQL, because I assume nobody else has tried Helga with an non-MySQL-db. If you need to upgrade, check /src/database/upgrade/3/helga_mysql.sql and do this manually for your database.

does not look that much better.

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodi c(Unknown Source)

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknow n Source)

at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

at java.lang.Thread.run(Unknown Source)

2008.02.27 00:52:46 [org.jivesoftware.openfire.plugin.helga.HelgaEventManager.loadFromDB(HelgaEvent Manager.java:426)

]

java.sql.SQLException: ResultSet may only be accessed in a forward direction.

at net.sourceforge.jtds.jdbc.JtdsResultSet.checkScrollable(JtdsResultSet.java:316)

at net.sourceforge.jtds.jdbc.JtdsResultSet.first(JtdsResultSet.java:528)

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

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

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

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

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

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

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

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

at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)

at java.util.concurrent.FutureTask$Sync.innerRunAndReset(Unknown Source)

at java.util.concurrent.FutureTask.runAndReset(Unknown Source)

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101 (Unknown Source)

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodi c(Unknown Source)

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknow n Source)

at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

at java.lang.Thread.run(Unknown Source)

2008.02.27 00:52:46 [org.jivesoftware.openfire.plugin.Helga.initializePlugin(Helga.java:88)

]

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

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

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

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

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

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

at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)

at java.util.concurrent.FutureTask$Sync.innerRunAndReset(Unknown Source)

at java.util.concurrent.FutureTask.runAndReset(Unknown Source)

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101 (Unknown Source)

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodi c(Unknown Source)

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknow n Source)

at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

at java.lang.Thread.run(Unknown Source)

Caused by: java.lang.NullPointerException

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

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

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

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

Ok, next try

helga-2.1-326.tar.gz

I used the method ResultSet.first() to check if the set is empty. Obviously SQL-Server does not support this. I took now ResultSet.next() which should do the same, but work for all databases.

Please report only complete error messages, this is not helpful:

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

Helga 2.11-333 released.

SQL-server should work now, but group features are still untested. thx@deafsquad.

Helga 2.20-397 released.

Helga can now compile LaTeX code

Helga groups do only support local group members, because Openfire does not support external users in groups well.

In the upcoming version of Helga you will get a slightly better error message. I solved this -bug a few days ago. The new version will released after I have applied the API changes in Openfire 3.5.0.

helga-2.21-410.tar.gz released.

@dfaure: Sorry, found your comment just after announcing the new version…I will integrate your “patch” in the next version.

yes would it be possible to add user list command to list user that have set public true and are publicly viewable.If So how or where mite I fined info on how to do this Bruce

Hi, sorry for answering so late…for some reason I did not get an email notification for your comment.

Such an command is easy to implement. Generally you will find information about Helga internals in the javadoc documentation, supplied with the package.

However, the easiest way to get the information you want is the following:

Helga has an internal user cache, which is maintained in class HelgaUserManager. In order to access it, you need the following method in HelgaUserManager, or something similar.

public synchronized List<String> getPublicUsers() {
     ArrayList<String> result = new ArrayList<String>();
     Iterator<Map.Entry<String, UserSettings>> itr = userCache.entrySet().iterator();
     while (itr.hasNext()) {
          Map.Entry<String, UserSettings> entry = itr.next();
          String userString = entry.getKey();
          UserSettings settings = entry.getValue();
          if (settings.publicPresence) {
               result.add(userString);
          }
     }
     return result;
}

An alternate way would be something like this:

SELECT jid FROM helgaUser WHERE presence=1;

But using the cache should be faster in most cases.

Now, with that information you can implement a new command, using the base class Command. Its relatively easy to use, there should be enough documentation about.

Thank you very much for the info coolcat.I Like helga groups bot very much she works very good on my windowsxp openfire.I will play some with this info in my spare time.It is upgrade time again so will be working on that.Please feel free to chat with me any time Bruce@kingshomeworld.com

Is Eclipse a good software for editing Helga

yes… netbeans also…

I’m using nothing else than KWrite, Console and Konqueror to edit Helga.

dont know what Kwrite is but Ihave been going threw the helga unzip with browser taking a look around I like.I am also using Sulci bot for my chat rooms but it wont login to openfire server I would like to integrate into helga some day if I can learn to edit and write helga but I am newbe so mite take some time thanks for your help

KWrite good for linux but I am using windows xp so that one wont work so well but thanks anyway Bruce

I can recommend Notepad 2 for Windows.

Sulci bot is written in Ocaml, which is according Wikipedia a mix of functional, imperative, and object-oriented programming languages (wtf!?). Unlike that, Helga is written in Java, which is an object-oriented language. Also Helga is an internal plugin, which works directly together with the server, e.g. using the same database connection and such things. Sulci seems to be an external component. It is impossible just to “integrate” one into the other…you will have to completely rewrite it.