~ubuntu-branches/ubuntu/natty/kadu/natty

« back to all changes in this revision

Viewing changes to externalmodules/plus_pl_sms/sendthread.h

  • Committer: Package Import Robot
  • Author(s): Kiszel Kristóf
  • Date: 2010-07-21 15:24:54 UTC
  • mfrom: (0.6.1) (0.5.1) (1.4.1) (22.1.2 maverick)
  • Revision ID: package-import@ubuntu.com-20100721152454-vttqle18lovfudni
Tags: 0.6.5.4.ds1-3ubuntu2
Remove libqt4-webkit-dev from build-depends and add
libqtwebkit-dev for qtwebkit transition

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef SENDTHREAD_H
 
2
#define SENDTHREAD_H
 
3
 
 
4
#include <curl/curl.h>
 
5
 
 
6
#include <QThread>
 
7
 
 
8
class SendThread : public QThread
 
9
{
 
10
        Q_OBJECT
 
11
        public:
 
12
                SendThread();
 
13
                ~SendThread();
 
14
        protected:
 
15
                CURL *curl;
 
16
                QString nr;
 
17
                QString msg;
 
18
                QString signature;
 
19
                QString body;
 
20
                QString bodyOfTcpSocket;
 
21
                QString JSESSCookie;
 
22
                QString othersInfos;
 
23
                QByteArray caBundlePath;
 
24
                int sentSMSesToPlus;
 
25
                int sentSMSesToOthers;
 
26
                char errorMsg[CURL_ERROR_SIZE];
 
27
                bool finished;
 
28
                bool success;
 
29
                bool displayInfos;
 
30
                enum ErrorType
 
31
                {
 
32
                        NO_ERROR,
 
33
                        CONNECTION_ERROR,
 
34
                        INVALID_LOGIN,
 
35
                        INVALID_SMS_SEND,
 
36
                        NO_FREE_MESSAGES_TO_OTHER_NETS,
 
37
                        SPAM_PROTECTION,
 
38
                        UNKNOWN_ERROR
 
39
                };
 
40
                ErrorType errorType;
 
41
 
 
42
                void initCurl();
 
43
                void cleanup();
 
44
                bool performGet(QString path);
 
45
                bool performPost(QString path, QString postData);
 
46
                ErrorType getErrorType() { return errorType; }
 
47
                bool getSentSMSesInfo();
 
48
                QString getJSessCookie(QString &body);
 
49
                bool login();
 
50
                bool postSMS();
 
51
                bool logout();
 
52
        public:
 
53
                virtual void run();
 
54
                QString getMsg() { return msg; }
 
55
                QString getNr() { return nr; }
 
56
                bool isFinished() { return finished; }
 
57
                bool isSuccess() { return success; }
 
58
                QString getErrorMsg();
 
59
                QString getInfosMsg();
 
60
                bool getDisplayInfos() { return displayInfos; }
 
61
        public slots:
 
62
                void setMsg(const QString &message) { msg = message; }
 
63
                void setNr(const QString &number) { nr = number; }
 
64
                void setSignature(const QString &newSignature) { signature = newSignature; }
 
65
                void setDisplayInfos(bool di = false) { displayInfos = di; }
 
66
        protected slots:
 
67
                void setFinished(bool f = true) { finished = f; }
 
68
                void setSuccess(bool s = true) { success = s; }
 
69
                void setErrorType(ErrorType err);
 
70
                bool validLogin();
 
71
                bool validSMSSend();
 
72
        friend size_t getBody(void *buffer, size_t size, size_t nmemb, SendThread *sendThread);
 
73
};
 
74
 
 
75
size_t getBody(void *buffer, size_t size, size_t nmemb, SendThread *sendThread);
 
76
 
 
77
#endif