Commit 4b383b9e authored by Dave Cridland's avatar Dave Cridland

Merge pull request #277 from PGoski/master

fixed MySQL Error 1093 in monitoring plugin ConversationManager & added description
parents 52923acf 1f68e1bc
...@@ -44,6 +44,11 @@ ...@@ -44,6 +44,11 @@
Monitoring Plugin Changelog Monitoring Plugin Changelog
</h1> </h1>
<p><b>1.4.6</b> -- Aug 11, 2015</p>
<ul>
<li>Added support for XEP-0313: Message Archive Management</li>
</ul>
<p><b>1.4.4</b> -- Oct 28, 2014</p> <p><b>1.4.4</b> -- Oct 28, 2014</p>
<ul> <ul>
<li>Fixed request conversations and messages</li> <li>Fixed request conversations and messages</li>
......
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
<name>Monitoring Service</name> <name>Monitoring Service</name>
<description>Monitors conversations and statistics of the server.</description> <description>Monitors conversations and statistics of the server.</description>
<author>Jive Software</author> <author>Jive Software</author>
<version>1.4.5</version> <version>1.4.6</version>
<date>10/28/2014</date> <date>11/08/2015</date>
<minServerVersion>3.9.0</minServerVersion> <minServerVersion>3.9.0</minServerVersion>
<databaseKey>monitoring</databaseKey> <databaseKey>monitoring</databaseKey>
<databaseVersion>3</databaseVersion> <databaseVersion>3</databaseVersion>
......
...@@ -86,7 +86,7 @@ public class ConversationManager implements Startable, ComponentEventListener{ ...@@ -86,7 +86,7 @@ public class ConversationManager implements Startable, ComponentEventListener{
private static final String UPDATE_CONVERSATION = "UPDATE ofConversation SET lastActivity=?, messageCount=? WHERE conversationID=?"; private static final String UPDATE_CONVERSATION = "UPDATE ofConversation SET lastActivity=?, messageCount=? WHERE conversationID=?";
private static final String UPDATE_PARTICIPANT = "UPDATE ofConParticipant SET leftDate=? WHERE conversationID=? AND bareJID=? AND jidResource=? AND joinedDate=?"; private static final String UPDATE_PARTICIPANT = "UPDATE ofConParticipant SET leftDate=? WHERE conversationID=? AND bareJID=? AND jidResource=? AND joinedDate=?";
private static final String INSERT_MESSAGE = "INSERT INTO ofMessageArchive(messageID, conversationID, fromJID, fromJIDResource, toJID, toJIDResource, sentDate, body, stanza) " private static final String INSERT_MESSAGE = "INSERT INTO ofMessageArchive(messageID, conversationID, fromJID, fromJIDResource, toJID, toJIDResource, sentDate, body, stanza) "
+ "VALUES ((SELECT COUNT(*) FROM ofMessageArchive),?,?,?,?,?,?,?,?)"; + "VALUES (?,?,?,?,?,?,?,?,?)";
private static final String CONVERSATION_COUNT = "SELECT COUNT(*) FROM ofConversation"; private static final String CONVERSATION_COUNT = "SELECT COUNT(*) FROM ofConversation";
private static final String MESSAGE_COUNT = "SELECT COUNT(*) FROM ofMessageArchive"; private static final String MESSAGE_COUNT = "SELECT COUNT(*) FROM ofMessageArchive";
private static final String DELETE_CONVERSATION_1 = "DELETE FROM ofMessageArchive WHERE conversationID=?"; private static final String DELETE_CONVERSATION_1 = "DELETE FROM ofMessageArchive WHERE conversationID=?";
...@@ -986,16 +986,20 @@ public class ConversationManager implements Startable, ComponentEventListener{ ...@@ -986,16 +986,20 @@ public class ConversationManager implements Startable, ComponentEventListener{
pstmt = con.prepareStatement(INSERT_MESSAGE); pstmt = con.prepareStatement(INSERT_MESSAGE);
ArchivedMessage message; ArchivedMessage message;
int msgCount = getArchivedMessageCount();
int count = 0; int count = 0;
while ((message = messageQueue.poll()) != null) { while ((message = messageQueue.poll()) != null) {
pstmt.setLong(1, message.getConversationID()); pstmt.setInt(1, ++msgCount);
pstmt.setString(2, message.getFromJID().toBareJID()); pstmt.setLong(2, message.getConversationID());
pstmt.setString(3, message.getFromJID().getResource()); pstmt.setString(3, message.getFromJID().toBareJID());
pstmt.setString(4, message.getToJID().toBareJID()); pstmt.setString(4, message.getFromJID().getResource());
pstmt.setString(5, message.getToJID().getResource()); pstmt.setString(5, message.getToJID().toBareJID());
pstmt.setLong(6, message.getSentDate().getTime()); pstmt.setString(6, message.getToJID().getResource());
DbConnectionManager.setLargeTextField(pstmt, 7, message.getBody()); pstmt.setLong(7, message.getSentDate().getTime());
DbConnectionManager.setLargeTextField(pstmt, 8, message.getStanza()); DbConnectionManager.setLargeTextField(pstmt, 8, message.getBody());
DbConnectionManager.setLargeTextField(pstmt, 9, message.getStanza());
if (DbConnectionManager.isBatchUpdatesSupported()) { if (DbConnectionManager.isBatchUpdatesSupported()) {
pstmt.addBatch(); pstmt.addBatch();
} else { } else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment