File indexing completed on 2024-04-28 07:54:10

0001  /*
0002   * jabbercontact.cpp  -  Kopete Jabber protocol groupchat contact
0003   *
0004   * Copyright (c) 2002-2004 by Till Gerken <till@tantalo.net>
0005   *
0006   * Kopete    (c) by the Kopete developers  <kopete-devel@kde.org>
0007   *
0008   * *************************************************************************
0009   * *                                                                       *
0010   * * This program is free software; you can redistribute it and/or modify  *
0011   * * it under the terms of the GNU General Public License as published by  *
0012   * * the Free Software Foundation; either either version 2
0013    of the License, or (at your option) any later version.of the License, or     *
0014   * * (at your option) any later version.                                   *
0015   * *                                                                       *
0016   * *************************************************************************
0017   */
0018 
0019 #ifndef JABBERGROUPCONTACT_H
0020 #define JABBERGROUPCONTACT_H
0021 
0022 #include "jabberbasecontact.h"
0023 
0024 #include <QList>
0025 
0026 // namespace Kopete { class MetaContact; }
0027 class JabberGroupChatManager;
0028 
0029 class JabberGroupContact : public JabberBaseContact
0030 {
0031 
0032 Q_OBJECT
0033 
0034 public:
0035 
0036     JabberGroupContact (const XMPP::RosterItem &rosterItem,
0037                         JabberAccount *account/*, Kopete::MetaContact * mc*/);
0038 
0039     ~JabberGroupContact ();
0040 
0041     /**
0042      * Create custom context menu items for the contact
0043      * FIXME: implement manager version here?
0044      */
0045 //  QList<QAction *> *customContextMenuActions ();
0046 
0047     /**
0048      * Deal with an incoming message for this contact.
0049      */
0050     void handleIncomingMessage ( const XMPP::Message &message );
0051 
0052     /**
0053      * Add a contact to this room.
0054      */
0055     JabberBaseContact *addSubContact ( const XMPP::RosterItem &rosterItem, bool addToManager = true );
0056 
0057     /**
0058      * Remove a contact from this room.
0059      */
0060     void removeSubContact ( const XMPP::RosterItem &rosterItem );
0061 
0062 //  Kopete::ChatSession *manager ( Kopete::Contact::CanCreateFlags canCreate = Kopete::Contact::CannotCreate );
0063 
0064 public slots:
0065 
0066     /**
0067      * This is the JabberContact level slot for sending files.
0068      *
0069      * @param sourceURL The actual KUrl of the file you are sending
0070      * @param fileName (Optional) An alternate name for the file - what the
0071      *                 receiver will see
0072      * @param fileSize (Optional) Size of the file being sent. Used when sending
0073      *                 a nondeterminate file size (such as over a socket)
0074      */
0075     virtual void sendFile( const KUrl &sourceURL = KUrl(),
0076         const QString &fileName = QString(), uint fileSize = 0L );
0077 
0078 private slots:
0079 
0080     /**
0081      * Catch a dying message manager and leave the room.
0082      */
0083     void slotChatSessionDeleted ();
0084     
0085     /**
0086      * When our own status change, we need to manually send the presence.
0087      */
0088     void slotStatusChanged();
0089     
0090     /**
0091      * ask the user to change the nick, and change it
0092      */
0093     void slotChangeNick();
0094     
0095     /**
0096      * a subcontact has been destroyed   (may happen when closing kopete)
0097      */
0098     void slotSubContactDestroyed(JabberBaseContact*);
0099 
0100 private:
0101 
0102     QList<JabberBaseContact*> mContactList;
0103 //  QList<Kopete::MetaContact*> mMetaContactList;
0104 
0105     JabberGroupChatManager *mManager;
0106     JabberBaseContact *mSelfContact;
0107     QString mNick;
0108 };
0109 
0110 #endif