<< Java on the iPhone? | Home | Maven vs Buildr >>

User Status Plugin for Openfire

Release 1.0.0 available under GPL

The User Status Plugin is a small plugin for Openfire 3.3.2 to save the user status to the Openfire database.

Use the plugin if you need easy access to the data from other applications or scripts that can access your Openfire database.

The plugin automatically saves the last status (presence, IP address, logon and logoff time) per user and resource to userStatus table in the Openfire database.

Optionally you can archive user status entries (IP address, logon and logoff time) for a specified time. History entries are stored in the userStatusHistory table. The settings for history archiving can be configured on the "User Status Settings" page that you'll find on the "Server" tab of the Openfire Admin Console.

Development of the plugin has been sponsored by Restomax.
It is available under GPL for download.

Note: Rename the plugin to user-status.jar before deploying it to the plugin folder of Openfire.

Tags :


Re: User Status Plugin for Openfire

Does this work with 3.3.3?

I have deployed it, but we dont seem to be getting accurate info.. We also went ahead and created the table (using the table definition described in the README). To get it going.

Any suggestions?

Sam.

Re: User Status Plugin for Openfire

Yes it also works with 3.3.0.
Do you see the new menu items in the admin console?

Re: User Status Plugin for Openfire

Sorry, that was user error. The table wasnt setup correctly (of if it had it's permissions had been incorrectly changed).

Thanks, this works a treat.

Sam.

Re: User Status Plugin for Openfire

Hi,
the user-status plugin seems to have problems with openfire 3.4.x
I like the plugin very much, it would be great, if you could release a new version for openfire 3.4.x !!

Re: User Status Plugin for Openfire

Thanks for your hint, you can find a new version of the plugin here.

Re: User Status Plugin for Openfire

The plugin does work with the embbeded DB. However the scheme has to be created manually. For this, stop the OpenFire server then add the following lines to embedded-db/openfire.script:
CREATE MEMORY TABLE userStatus (
  username VARCHAR(64) NOT NULL,
  resource VARCHAR(64) NOT NULL,
  online INTEGER NOT NULL,
  presence CHAR(15),
  lastIpAddress CHAR(15) NOT NULL,
  lastLoginDate CHAR(15) NOT NULL,
  lastLogoffDate  CHAR(15), 
  PRIMARY KEY (username, resource))
CREATE MEMORY TABLE userStatusHistory (
  historyID BIGINT NOT NULL,
  username VARCHAR(64) NOT NULL,
  resource VARCHAR(64) NOT NULL,
  lastIpAddress CHAR(15) NOT NULL,
  lastLoginDate CHAR(15) NOT NULL,
  lastLogoffDate CHAR(15) NOT NULL,
  PRIMARY KEY (historyID))
Note: you must edit the text above so that each CREATE MEMORY TABLE statement fits on a single line. The embedded DB driver has a very simple SQL parser which takes statements one line at a time. Then restart OpenFire. During operation, when users connect / disconnect / update their status the plugin will generate entries to openfire.log and openfire.script. These can be extracted later using "grep" commands.

Re: User Status Plugin for Openfire

Works with Openfire 3.4.5 with sqlserver if you use insert the following code into a file name user-status_sqlserver.sql and put the file in the databse folder in the jar. Perhaps Stefan can add this in the next release.

CREATE TABLE userStatus (
    username        NVARCHAR(64)         NOT NULL,
    resource        NVARCHAR(64)         NOT NULL,
    online          TINYINT             NOT NULL,
    presence        NVARCHAR(15),
    lastIpAddress   NVARCHAR(15)            NOT NULL,
    lastLoginDate   NVARCHAR(15)            NOT NULL,
    lastLogoffDate  NVARCHAR(15),
    CONSTRAINT userStatus_pk PRIMARY KEY (username, resource)
);

CREATE TABLE userStatusHistory (
    historyID       BIGINT              NOT NULL,
    username        NVARCHAR(64)         NOT NULL,
    resource        NVARCHAR(64)         NOT NULL,
    lastIpAddress   NVARCHAR(15)            NOT NULL,
    lastLoginDate   NVARCHAR(15)            NOT NULL,
    lastLogoffDate  NVARCHAR(15)            NOT NULL,
    CONSTRAINT userStatusHistory_pk PRIMARY KEY (historyID)
);

INSERT INTO jiveVersion (name, version) VALUES ('user-status', 0);

Re: User Status Plugin for Openfire

Thanks for your contribution. I've added the script to svn so it will be part of the next release.

Add a comment Send a TrackBack