00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef _CHATSESSION_H_
00012 #define _CHATSESSION_H_
00013
00014 #define CHAT_BUFFER_LENGTH 256
00015
00016 #include <qwidget.h>
00017 #include <qdom.h>
00018 #include <vector>
00019
00020 #include "chatpage.h"
00021 #include "version.h"
00022 #include "master.h"
00023
00024 class QProcess;
00025 class QAction;
00026 class QString;
00027 class QStringList;
00028 class QStyleSheetItem;
00029 class TelnetManager;
00030 class MtpSettings;
00031 class QMtp;
00032 class QResizeEvent;
00033 class MtpFilter;
00034 class MtpContext;
00035 class Page;
00036
00037 class ChatSession : public ChatPage {
00038 Q_OBJECT
00039
00040 public:
00041 ChatSession(const QString& session_name, QMtp * mtp, QWidget *parent, const char *name,QDomDocument * dom);
00042 ~ChatSession();
00043
00044 void displayStderr(const QString&);
00045 void displayStdout(const QString&);
00046 const QString & sessionName() const;
00047 QMtp* topLevel() const;
00048
00049 void updateFilters();
00050
00051 public slots:
00052 void returnPressed();
00053 void closeSession();
00054 void slotLinkClicked(const QString &);
00055 void slotHistoryUp();
00056 void slotHistoryDown();
00057 void slotNewLine();
00058 void slotComplete();
00059 void slotReconnect();
00060
00061 void setDomDocument(QDomDocument * dom);
00062 void kill(Page*);
00063 void send(const QString &);
00064
00065 private:
00066 void escape(QString * msg);
00067 bool filter(QString * msg);
00068 void getInfo();
00069
00070 QString caseUnsensitive(const QString& msg);
00071
00072 void removeUser(const QString&);
00073 void addUser(const QString&);
00074
00075 void executeShellCommand(const QString&);
00076 void createTelnetManager();
00077
00078 QProcess * proc;
00079
00080 QMtp * mtp;
00081 TelnetManager * mng;
00082 QString login;
00083 bool login_set;
00084 bool enable_stdout;
00085 bool who_demanded;
00086 bool receiving_who;
00087 int position;
00088
00089 QString doc_source;
00090
00091 QStyleSheetItem *item;
00092 QAction *history_up, *history_down, *new_line, *complete, *reconnect;
00093 QStringList history;
00094 QStringList::Iterator history_iterator;
00095 QString host, port, session_name;
00096
00097 QDomDocument * m_dom;
00098 MtpFilter * m_filter;
00099
00100 std::vector<Page *> brothers;
00101
00102 signals:
00103 void textDisplayed(QWidget *);
00104 private slots:
00105 void deleteProcess();
00106 signals:
00107 void outputMessage(const QString& );
00108 };
00109
00110 #endif