<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -24,10 +24,36 @@ ConversationDebug::ConversationDebug(mySQLData myDBData, string myMethod, string
   method = myMethod;
   remoteHost = myRemoteHost;
 
+  disabled = checkIfDisabledForThisMethod();
   create();
 }
 
+bool ConversationDebug::checkIfDisabledForThisMethod(){
+  stringstream query;
+  query &lt;&lt; &quot;SELECT &quot;;
+
+  if(method == &quot;smtp&quot;){
+    query &lt;&lt; &quot;conversation_logging_smtp&quot;;
+  }else if(method == &quot;xmpp&quot;){
+    query &lt;&lt; &quot;conversation_logging_xmpp&quot;;
+  }else{
+    return 1;
+  }
+
+  query &lt;&lt; &quot; FROM settings ORDER BY id DESC LIMIT 1&quot;;
+
+  if(initConnection()){
+    string result = sGetQuery(query.str());
+    mysql_close(getHandle());
+    if(result == &quot;1&quot;) { return 0; }
+  }
+
+  return 1;
+}
+
 void ConversationDebug::create(){
+  if(disabled) { return; }  
+
   static timeval tv;
   static timeval tv2;
   static struct timezone tz;
@@ -46,11 +72,14 @@ void ConversationDebug::create(){
 
   if(initConnection()){
     setQuery(getHandle(), query.str());
+    mysql_close(getHandle());
   }
 }
 
 
 void ConversationDebug::log(unsigned int direction, string message){
+  if(disabled) { return; }  
+
   stringstream query;
   query &lt;&lt; &quot;INSERT INTO conversationmessages(conversation_id, direction, message, created_at) VALUES(&quot;
         &lt;&lt; conversationID
@@ -61,6 +90,7 @@ void ConversationDebug::log(unsigned int direction, string message){
         &lt;&lt; &quot;', NOW())&quot;;
   if(initConnection()){
     setQuery(getHandle(), query.str());
+    mysql_close(getHandle());
   }
 }
 </diff>
      <filename>src/log/ConversationDebug.cpp</filename>
    </modified>
    <modified>
      <diff>@@ -26,8 +26,10 @@ class ConversationDebug : public Database {
     unsigned int conversationID;
     string method;
     string remoteHost;
+    bool disabled;
 
     void create();
+    bool checkIfDisabledForThisMethod();
 	public:
     ConversationDebug(mySQLData myDBData, string myMethod, string myRemoteHost);
 </diff>
      <filename>src/log/ConversationDebug.h</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>6bcf90012233430953387e3b6ad75ec521ad28d5</id>
    </parent>
  </parents>
  <author>
    <name>lennartkoopmann</name>
    <login>lennartkoopmann</login>
    <email>lennart@scopeport.org</email>
  </author>
  <url>http://github.com/lennartkoopmann/scopeport-server/commit/c2a3f79903dbaeb6b5f82098a09e0449f2942638</url>
  <id>c2a3f79903dbaeb6b5f82098a09e0449f2942638</id>
  <committed-date>2009-07-12T12:49:17-07:00</committed-date>
  <authored-date>2009-07-12T12:49:17-07:00</authored-date>
  <message>Now logging SMTP conversations if enabled in web interface</message>
  <tree>3e638ca58571e539265cdb7880c08a44dce283d3</tree>
  <committer>
    <name>lennartkoopmann</name>
    <login>lennartkoopmann</login>
    <email>lennart@scopeport.org</email>
  </committer>
</commit>
