new version with hashtags
This commit is contained in:
parent
d81ad52031
commit
56bdb80ea0
47 changed files with 1424 additions and 825 deletions
|
@ -45,7 +45,6 @@
|
|||
#include <QSqlDatabase>
|
||||
#include <QSqlError>
|
||||
#include <QDateTime>
|
||||
//#include "AndroidNative/systemdispatcher.h"
|
||||
|
||||
|
||||
|
||||
|
@ -110,7 +109,6 @@ void UPDATENEWS::login()
|
|||
m_updateInterval=0;
|
||||
syncindex=0;
|
||||
synclist.clear();
|
||||
//QSqlQuery syncquery("SELECT * FROM globaloptions WHERE k like 'sync_%' AND v=1",m_db);
|
||||
while (syncquery.next()){
|
||||
if (syncquery.value(0).toString()=="syncinterval"){
|
||||
m_updateInterval=syncquery.value(1).toInt();
|
||||
|
@ -129,9 +127,7 @@ void UPDATENEWS::login()
|
|||
if (synctimequery.next()){
|
||||
QSqlQuery synctimequery2("UPDATE globaloptions SET v='"+QString::number(QDateTime::currentSecsSinceEpoch()) + "' WHERE k = 'lastsync'",m_db);
|
||||
if(!(synctimequery2.exec())) {qDebug()<<" synctimequery2 " << synctimequery2.lastError();}
|
||||
//qDebug() << " synctimequery ";
|
||||
} else {
|
||||
//qDebug() << "INSERT INTO globaloptions(k,v) VALUES('lastsync','"+QString::number(QDateTime::currentSecsSinceEpoch()) + "'";
|
||||
QSqlQuery synctimequery3("INSERT INTO globaloptions(k,v) VALUES('lastsync','"+QString::number(QDateTime::currentSecsSinceEpoch()) + "')",m_db);
|
||||
if(!(synctimequery3.exec())) {qDebug() << " synctimequery3 " << synctimequery3.lastError();}
|
||||
}
|
||||
|
@ -260,7 +256,6 @@ void UPDATENEWS::events()
|
|||
QObject::disconnect(&xhr,SIGNAL(success(QByteArray,QString)),this,SLOT(store(QByteArray,QString)));
|
||||
QObject::connect(&xhr,SIGNAL(success(QByteArray,QString)),this,SLOT(storeEvents(QByteArray,QString)));
|
||||
QObject::connect(&xhr,SIGNAL(error(QString,QString,QString,int)),this,SLOT(showError(QString,QString,QString,int)));
|
||||
//QObject::connect(&xhr, SIGNAL(downloaded(QString, QString, QString, int)), this, SLOT(updateImageLocation(QString,QString, QString, int)));
|
||||
}
|
||||
|
||||
|
||||
|
@ -293,7 +288,10 @@ void UPDATENEWS::store(QByteArray serverreply,QString apiname)
|
|||
query.bindValue(8,newsitem["geo"]);
|
||||
query.bindValue( 9, newsitem["favorited"].toInt());
|
||||
query.bindValue(10, newsitem["user"]["id"].toInt());
|
||||
query.bindValue(11, newsitem["statusnet_html"].toString().toUtf8().toBase64());
|
||||
if (newsitem["friendica_title"]!="") {
|
||||
QString friendicaHtml="<b>" + newsitem["friendica_title"].toString() +"</b><br><br>"+newsitem["friendica_html"].toString();
|
||||
query.bindValue(11, friendicaHtml.toUtf8().toBase64());}
|
||||
else{query.bindValue(11, newsitem["friendica_html"].toString().toUtf8().toBase64());}
|
||||
query.bindValue(12, newsitem["statusnet_conversation_id"].toInt());
|
||||
QJsonArray likeArray;QJsonArray dislikeArray;QJsonArray attendyesArray;QJsonArray attendnoArray;QJsonArray attendmaybeArray;
|
||||
if (newsitem.toObject().contains("friendica_activities")){
|
||||
|
@ -382,7 +380,6 @@ void UPDATENEWS::store(QByteArray serverreply,QString apiname)
|
|||
}
|
||||
}
|
||||
QList<QJsonValue> newcontacts=findNewContacts(news);
|
||||
//qDebug()<< "new contacts count " << newcontacts.size();
|
||||
if (newcontacts.size()>0){
|
||||
updateContacts(newcontacts);
|
||||
startImagedownload();
|
||||
|
@ -410,7 +407,6 @@ void UPDATENEWS::updateImageLocation(QString downloadtype,QString imageurl, QStr
|
|||
if (downloadtype=="contactlist"){
|
||||
QSqlQuery testquery("SELECT profile_image FROM contacts WHERE profile_image_url ='"+imageurl+ "' AND username = '" +username+"'",m_db);
|
||||
testquery.first();
|
||||
//qDebug()<< "update imageurl for " <<imageurl << " from " <<testquery.value(0).toString() <<" to "<< filename <<" index " << index << " newcontactnames.length " <<newcontactnames.length();
|
||||
QSqlQuery query("UPDATE contacts SET profile_image='"+ filename +"' WHERE profile_image_url ='"+imageurl+ "' AND username = '" +username+"'",m_db);
|
||||
if(!(query.exec())) {qDebug()<< "updateImagelocation " << query.lastError();}
|
||||
if (index==(newcontactnames.length()-1)){
|
||||
|
@ -441,7 +437,6 @@ QList <QJsonValue> UPDATENEWS::findNewContacts(QJsonDocument news){
|
|||
imageurls.append(query.value(0).toString());
|
||||
}
|
||||
QList<QJsonValue> newcontacts;
|
||||
//qDebug()<<"updatenews findcontacts news count "<<news.array().count();
|
||||
|
||||
for (int i=0; i<news.array().count();i++){
|
||||
//main contacts
|
||||
|
@ -505,7 +500,6 @@ void UPDATENEWS::updateContacts(QList<QJsonValue> contacts){
|
|||
QJsonValue contact=contacts[i];
|
||||
QSqlQuery query(m_db);
|
||||
try{
|
||||
//qDebug() << "updatecontact " << contact["screen_name"];
|
||||
QSqlQuery testquery("SELECT url FROM contacts WHERE username='"+ username +"' AND url='" + contact["url"].toString() +"'",m_db);
|
||||
if (testquery.first()){
|
||||
query.prepare("UPDATE contacts SET id=?, name=?, screen_name=?, location=?,imageAge=?,"
|
||||
|
@ -595,7 +589,6 @@ void UPDATENEWS::updateContacts(QList<QJsonValue> contacts){
|
|||
void UPDATENEWS::storeEvents(QByteArray serverreply,QString apiname)
|
||||
{ if (apiname!=m_api || xhr.downloadtype()!=""){} else {
|
||||
QJsonDocument events;
|
||||
//qDebug()<<apiname << serverreply;
|
||||
QJsonParseError jsonerror;
|
||||
events=QJsonDocument::fromJson(serverreply,&jsonerror);
|
||||
if (events.isArray()){
|
||||
|
@ -650,7 +643,6 @@ QString UPDATENEWS::url() const
|
|||
|
||||
void UPDATENEWS::startImagedownload()
|
||||
{
|
||||
//qDebug() << "start image download";
|
||||
xhr.setDownloadtype("contactlist");
|
||||
xhr.setFilelist(newcontactimagelinks);
|
||||
xhr.setContactlist(newcontactnames);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue