• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepimlibs API Reference
  • KDE Home
  • Contact Us
 

KIMAP Library

  • sources
  • kde-4.14
  • kdepimlibs
  • kimap
sessionlogger.cpp
1 /*
2  Copyright (c) 2010 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
3  Author: Kevin Ottens <kevin@kdab.com>
4 
5  This library is free software; you can redistribute it and/or modify it
6  under the terms of the GNU Library General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or (at your
8  option) any later version.
9 
10  This library is distributed in the hope that it will be useful, but WITHOUT
11  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13  License for more details.
14 
15  You should have received a copy of the GNU Library General Public License
16  along with this library; see the file COPYING.LIB. If not, write to the
17  Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18  02110-1301, USA.
19 */
20 
21 #include "sessionlogger_p.h"
22 
23 #include <KDebug>
24 
25 #include <unistd.h>
26 
27 using namespace KIMAP;
28 
29 SessionLogger::SessionLogger()
30  : m_id( 0 )
31 {
32  static qint64 nextId = 0;
33  m_id = ++nextId;
34 
35  m_file.setFileName( QLatin1String(qgetenv( "KIMAP_LOGFILE" ))
36  + QLatin1Char('.') + QString::number( getpid() )
37  + QLatin1Char('.') + QString::number( m_id ) );
38  if (!m_file.open( QFile::WriteOnly )) {
39  kDebug()<<" m_file can be open in write only";
40  }
41 }
42 
43 SessionLogger::~SessionLogger()
44 {
45  m_file.close();
46 }
47 
48 void SessionLogger::dataSent( const QByteArray &data )
49 {
50  m_file.write( "C: "+data.trimmed()+'\n' );
51  m_file.flush();
52 }
53 
54 void SessionLogger::dataReceived( const QByteArray &data )
55 {
56  m_file.write( "S: "+data.trimmed()+'\n' );
57  m_file.flush();
58 }
59 
60 void SessionLogger::disconnectionOccured()
61 {
62  m_file.write( "X\n" );
63 }
QByteArray::trimmed
QByteArray trimmed() const
QByteArray
QString::number
QString number(int n, int base)
QLatin1Char
QLatin1String
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:37:03 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KIMAP Library

Skip menu "KIMAP Library"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • Related Pages

kdepimlibs API Reference

Skip menu "kdepimlibs API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal