vodafone190 is an open source project powered by Assembla

Assembla offers free public and private SVN/Git repositories and project hosting with bug/issue tracking and collaboration tools.

vodafone190

/
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
//    Vodafone 190
//    Copyright (C) 2011 Paolo Iommarini
//    sakya_tg@yahoo.it
//
//    This program is free software; you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation; either version 2 of the License, or
//    (at your option) any later version.
//
//    This program is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//
//    You should have received a copy of the GNU General Public License
//    along with this program; if not, write to the Free Software
//    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
#ifndef VODAFONEWIDGET_H
#define VODAFONEWIDGET_H

#include <QDebug>
#include <QObject>
#include <QNetworkAccessManager>
#include <QUrl>
#include <QNetworkReply>
#include <QSslError>
#include <QNetworkCookieJar>
#include <QAuthenticator>
#include <QDomDocument>
#include <QEventLoop>
#include <QStringList>

#include "counter.h"
#include "saldopunti.h"
#include "infoconto.h"

// http://demos.vodafone.it/dw/getDWConfiguration.xml
// http://demos.vodafone.it/widget/contatori/getDWConfiguration.xml

//Cambio sim:
// https://widget.vodafone.it/190/trilogy/jsp/swapSim.do?ty_sim=xxxxxxxxxx

//Info conto:
// https://widget.vodafone.it/190/ebwe/mx/PushInfoconto.do?hpfdtpri=y

//Credito Residuo:
// https://widget.vodafone.it/190/fast/mx/CreditoResiduoPush.do?hpfdtpri=y

//Elenco contatori:
// https://widget.vodafone.it/190/ebwe/mx/Desktopwidgetconto.do

//Dettaglio contatore:
// https://widget.vodafone.it/190/ebwe/mx/DesktopwidgetContatoreDettagli.do?ProductType=P&Classe=2&ProductCode=888

class VodafoneWidget : public QObject
{
public:
    enum SimType {
        SimUnknown,
        SimRicaricabile,
        SimContratto,
    };

    VodafoneWidget(QString username, QString password);
     ~VodafoneWidget();

    bool DebugXml;
    void SetCredentials(QString username, QString password);
    bool IsLoggedIn();
    bool Login();
    void Logout();

    QStringList GetSims();
    QString GetCurrentSim();
    SimType GetCurrentSimType();

    bool SetCurrentSim(QString sim);

    float GetCredito(QString* valuta);
    bool GetInfoConto(InfoConto* info);
    QList<Counter*>* GetListaContatori(bool includeStandard=false);
    bool GetDettaglioContatore(Counter* counter);
    bool GetSaldoPunti(SaldoPunti* saldo);

    bool PrepareMessage(QString receiver, QString message, QByteArray* captchaImage, QString* errorMessage=0);
    bool SendMessage(QString receiver, QString message, QString captcha, QString* errorMessage=0);

    void AbortRequest();

private:
    QStringList m_Sims;
    QString m_CurrentSim;
    SimType m_CurrentSimType;

    bool m_Aborting;
    QNetworkReply* m_CurrentReply;

    QString m_SessionID;
    QNetworkCookieJar* m_CookieJar;
    QNetworkAccessManager* m_Nam;

    QString m_Username;
    QString m_Password;

    QString GetReturnCode(QDomDocument doc);
    QString GetStatus(QDomDocument doc, QString* errorMessage=0);
    QNetworkRequest PrepareRequest(QUrl url, bool vodafoneUserAgent=true);
    QNetworkRequest PrepareRequest(QString url, bool vodafoneUserAgent=true);
    QString SynchRequest(QNetworkRequest* request, QUrl* redirectUrl=NULL);

    QString Decrypt(QString* crypted, QString* sessionID);
};

#endif // VODAFONEWIDGET_H
Ajax-loader Loading, please wait...