Skip to content

Commit

Permalink
some improovments for yandexnarodplugin
Browse files Browse the repository at this point in the history
  • Loading branch information
wadealer committed Oct 19, 2011
1 parent a815c3c commit 6c8053a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
1 change: 1 addition & 0 deletions generic/yandexnarodplugin/changelog.txt
Expand Up @@ -7,6 +7,7 @@ v0.0.5
* исправлен показ кол-ва файлов в списке
+ добавлена возможность получить ссылки для скачивания простым перетаскиванием файлов в поле ввода
* изменен дизайн окна менеджера
+ исправлена работа для случая, когда в настройках паспорта стоит "Узнавать меня всегда"


2011-10-18
Expand Down
4 changes: 1 addition & 3 deletions generic/yandexnarodplugin/yandexnarod.cpp
Expand Up @@ -214,9 +214,7 @@ void yandexnarodPlugin::onFileURL(const QString& url)

QString yandexnarodPlugin::pluginInfo()
{
return trUtf8("Ported from QutIM Yandex.Narod plugin\nhttp://qutim.org/forum/viewtopic.php?f=62&t=711\n\n"
"If authorization fails, go to page http://passport.yandex.ru/passport?mode=tune"
" and enable \"Don't remember me\" option");
return trUtf8("Ported from QutIM Yandex.Narod plugin\nhttp://qutim.org/forum/viewtopic.php?f=62&t=711\n\n");
}

Q_EXPORT_PLUGIN(yandexnarodPlugin);
15 changes: 13 additions & 2 deletions generic/yandexnarodplugin/yandexnarodnetman.cpp
Expand Up @@ -47,6 +47,17 @@ static QNetworkAccessManager* newMnager(QObject* parent)
return netman;
}

// function needed for tests only
//static void saveData(const QString& text)
//{
// //qDebug() << text;
// QFile file(QDir::homePath() + "/page.html");
// if(file.open(QIODevice::WriteOnly | QIODevice::Truncate) ) {
// QTextStream str(&file);
// str << QString::fromUtf8(text.toLatin1());
// }
//}

//-------------------------------------------
//------AuthManager--------------------------
//-------------------------------------------
Expand Down Expand Up @@ -144,6 +155,7 @@ void AuthManager::timeout()

void AuthManager::replyFinished(QNetworkReply* reply)
{
//saveData(reply->readAll());
QString replycookstr = reply->rawHeader("Set-Cookie");
if (!replycookstr.isEmpty()) {
QNetworkCookieJar *netcookjar = manager_->cookieJar();
Expand All @@ -159,7 +171,7 @@ void AuthManager::replyFinished(QNetworkReply* reply)
if (rx.indexIn(page) > 0) {
QRegExp rx1("<input type=\"hidden\" name=\"idkey\" value=\"(\\S+)\"[^>]*>");
if (rx1.indexIn(page) > 0) {
QByteArray post = "idkey="+rx1.cap(1).toAscii()+"&no=no";
QByteArray post = "idkey=" + rx1.cap(1).toAscii() + "&filled=yes";
QNetworkRequest nr = newRequest();
nr.setUrl(authUrl);
manager_->post(nr, post);
Expand Down Expand Up @@ -473,7 +485,6 @@ void yandexnarodNetMan::netrpFinished( QNetworkReply* reply )
{
if(reply->error() == QNetworkReply::NoError) {
QString page = reply->readAll();
//qDebug()<<"PAGE"<<page;

if (action == "get_filelist") {
page.replace("<wbr/>", "");
Expand Down

0 comments on commit 6c8053a

Please sign in to comment.