Bonjour nick name is in Latin1 encoding
[kdenetwork.git] / kopete / protocols / irc / irccontact_server.cpp
blob632ead1f0569d918d43e7c93d6cbee56e9934c5d
1 /*
2 ircservercontact.cpp - IRC Server Contact
4 Copyright (c) 2002 by Nick Betcher <nbetcher@kde.org>
5 Copyright (c) 2003-2007 by Michel Hermier <mhermier@gmail.com>
7 Kopete (c) 2002-2003 by the Kopete developers <kopete-devel@kde.org>
9 *************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 *************************************************************************
19 #include "ircaccount.h"
20 #include "irccontact.h"
21 #include "ircprotocol.h"
23 #include "kopetechatsessionmanager.h"
24 #include "kopeteview.h"
26 #include <kaction.h>
27 #include <kdebug.h>
28 #include <klocale.h>
30 #include <qtimer.h>
32 void IRCServerContact::slotSendMsg(Kopete::Message &, Kopete::ChatSession *manager)
34 manager->messageSucceeded();
35 Kopete::Message msg( manager->myself(), manager->members(),
36 i18n("You cannot talk to the server, you can only issue commands here. Type /help for supported commands."), Kopete::Message::Internal, Kopete::Message::PlainText, CHAT_VIEW);
37 manager->appendMessage(msg);
40 void IRCServerContact::appendMessage( const QString &message )
42 Kopete::ContactPtrList members;
43 members.append( this );
44 Kopete::Message msg( this, members, message, Kopete::Message::Internal,
45 Kopete::Message::RichText, CHAT_VIEW );
46 appendMessage(msg);
49 void IRCServerContact::slotIncomingNotice( const QString &orig, const QString &notice )
51 QString originator = orig.contains('!') ? orig.section('!',0,1) : orig;
52 ircAccount()->appendMessage(
53 i18n("NOTICE from %1: %2").arg(
54 originator == ircAccount()->mySelf()->nickName() ? kircEngine()->currentHost() : originator, notice
56 IRCAccount::NoticeReply
60 void IRCServerContact::slotDumpMessages()
62 if (!mMsgBuffer.isEmpty())
64 manager()->appendMessage( mMsgBuffer.front() );
65 mMsgBuffer.pop_front();
66 QTimer::singleShot( 0, this, SLOT( slotDumpMessages() ) );
70 void IRCServerContact::slotViewCreated( KopeteView *v )
72 kDebug(14121) << "Created: " << v << ", mgr: " << v->msgManager() << ", Mine: " << m_chatSession;
73 if (m_chatSession && v->msgManager() == m_chatSession)
74 QTimer::singleShot(500, this, SLOT(slotDumpMessages()));