26 #include <tqcstring.h>
29 #include <tdelocale.h>
30 #include <kinstance.h>
31 #include <tdeglobal.h>
33 #include <tdeio/global.h>
37 #include <tdemacros.h>
41 extern "C" { TDE_EXPORT
int kdemain(
int argc,
char* argv[]); }
43 int kdemain(
int argc,
char * argv[] )
45 TDELocale::setMainCatalogue(
"tdelibs");
46 TDEInstance instance(
"tdeio_mbox");
47 (void) TDEGlobal::locale();
50 fprintf(stderr,
"Usage: tdeio_mbox protocol "
51 "domain-socket1 domain-socket2\n");
62 : TDEIO::SlaveBase(
"mbox2", arg1, arg2 ),
76 UrlInfo info( url, UrlInfo::message );
80 if( info.type() == UrlInfo::invalid && !m_errorState )
82 error( TDEIO::ERR_DOES_NOT_EXIST, info.url() );
88 while( !mbox.
atEnd() && !m_errorState)
92 ba_line = TQCString( line.utf8() );
93 ba_line.truncate( ba_line.size() - 1 );
100 data( TQByteArray() );
107 m_errorState =
false;
109 TDEIO::UDSEntry entry;
110 UrlInfo info( url, UrlInfo::directory );
111 ReadMBox mbox( &info,
this, hasMetaData(
"onlynew" ), hasMetaData(
"savetime" ) );
116 if( info.type() != UrlInfo::directory )
118 error( TDEIO::ERR_DOES_NOT_EXIST, info.url() );
122 while( !mbox.
atEnd() && !m_errorState )
126 listEntry( entry,
false );
129 listEntry( TDEIO::UDSEntry(),
true );
136 if( info.type() == UrlInfo::invalid )
138 error( TDEIO::ERR_DOES_NOT_EXIST, url.path() );
149 m_errorState =
false;
156 if( info.type() == UrlInfo::invalid )
157 error( TDEIO::ERR_DOES_NOT_EXIST, i18n(
"Invalid URL" ) );
159 mimeType( info.mimetype() );
This class is the main class and implements all function which can be called through the user.
virtual void stat(const KURL &url)
This functions gives general properties about a mbox-file, or mbox-email back.
virtual void get(const KURL &url)
This functions is used when an user or a program wants to get a file from a mbox-file.
MBoxProtocol(const TQCString &, const TQCString &)
Constructor, for the parameters, See TDEIO::SlaveBase.
virtual ~MBoxProtocol()
Empty destructor.
virtual void mimetype(const KURL &url)
This functions determinate the mimetype of a given mbox-file or mbox-email.
void emitError(int errno, const TQString &arg)
Through this functions, other class which have an instance to this class (classes which are part of t...
virtual void listDir(const KURL &url)
This functions gives a listing back.
This class handels reading from a mbox-file.
bool nextLine()
This function reads the next line.
bool inListing() const
Return true if the message is a new message, or all messages are listed.
TQString currentLine() const
This functions return the current line.
bool atEnd() const
Returns true if the cursor is at EOF.
static TDEIO::UDSEntry stat(const UrlInfo &info)
This functions gives information with a given UrlInfo.