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.
Re: User Status Plugin for Openfire
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
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);