summaryrefslogtreecommitdiffstats
path: root/ksirc/messageReceiver.cpp
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commitbcb704366cb5e333a626c18c308c7e0448a8e69f (patch)
treef0d6ab7d78ecdd9207cf46536376b44b91a1ca71 /ksirc/messageReceiver.cpp
downloadtdenetwork-bcb704366cb5e333a626c18c308c7e0448a8e69f.tar.gz
tdenetwork-bcb704366cb5e333a626c18c308c7e0448a8e69f.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'ksirc/messageReceiver.cpp')
-rw-r--r--ksirc/messageReceiver.cpp73
1 files changed, 73 insertions, 0 deletions
diff --git a/ksirc/messageReceiver.cpp b/ksirc/messageReceiver.cpp
new file mode 100644
index 00000000..f2ac6ee0
--- /dev/null
+++ b/ksirc/messageReceiver.cpp
@@ -0,0 +1,73 @@
+#include "messageReceiver.h"
+
+#include <qtextcodec.h>
+#include <kcharsets.h>
+#include <kglobal.h>
+#include <kdebug.h>
+#include <assert.h>
+
+KSircMessageReceiver::KSircMessageReceiver( KSircProcess * _proc )
+{
+ proc = _proc;
+ broadcast = TRUE;
+}
+
+KSircMessageReceiver::~KSircMessageReceiver()
+{
+}
+
+void KSircMessageReceiver::setBroadcast(bool bd)
+{
+ broadcast = bd;
+}
+
+bool KSircMessageReceiver::getBroadcast()
+{
+ return broadcast;
+}
+
+filterRuleList *KSircMessageReceiver::defaultRules()
+{
+ return new filterRuleList();
+}
+
+UnicodeMessageReceiver::UnicodeMessageReceiver( KSircProcess *process )
+ : KSircMessageReceiver( process ), m_encoder( 0 )
+{
+}
+
+void UnicodeMessageReceiver::sirc_receive( QCString str, bool broadcast )
+{
+ assert( encoder() );
+ //kdDebug(5008) << "Encoder: " << encoder()->name() << endl;
+ //kdDebug(5008) << "It gives us: " << encoder()->toUnicode( str ).utf8() << endl;
+ sirc_receive( encoder()->toUnicode( str ), broadcast );
+}
+
+void UnicodeMessageReceiver::setEncoding( const QString &encoding )
+{
+ m_encoding = encoding;
+ m_encoder = 0;
+}
+
+QString UnicodeMessageReceiver::encoding() const
+{
+ if ( m_encoding.isEmpty() )
+ return QTextCodec::codecForLocale()->mimeName();
+ return m_encoding;
+}
+
+QTextCodec *UnicodeMessageReceiver::encoder() const
+{
+ if ( m_encoding.isEmpty() ) {
+ return QTextCodec::codecForLocale();
+ }
+
+ if ( !m_encoder ) {
+ const_cast<UnicodeMessageReceiver *>( this )->m_encoder = KGlobal::charsets()->codecForName( m_encoding );
+ assert( m_encoder );
+ }
+
+ return m_encoder;
+}
+