v0.6.4 contact search

master
LubuWest 9 months ago
parent 66e5c33b00
commit 5032c78de1
  1. 12
      CHANGELOG.md
  2. 15
      README.md
  3. 6
      source-android/android/AndroidManifest.xml
  4. 7
      source-android/friendiqa.pro
  5. 19
      source-android/qml/friendiqa.qml
  6. 62
      source-linux/CMakeLists.txt
  7. 4
      source-linux/application.qrc
  8. 2
      source-linux/common/filesystem.cpp
  9. 3
      source-linux/common/friendiqa.cpp
  10. 186
      source-linux/common/updatenews.cpp
  11. 4
      source-linux/common/updatenews.h
  12. 9
      source-linux/common/xhr.cpp
  13. 2
      source-linux/common/xhr.h
  14. BIN
      source-linux/images/Friendiqa.ico
  15. 2
      source-linux/images/de.manic.Friendiqa.desktop
  16. 0
      source-linux/images/de.manic.Friendiqa.svg
  17. 6
      source-linux/js/helper.js
  18. 444
      source-linux/js/news.js
  19. 167
      source-linux/js/newsworker.js
  20. 602
      source-linux/js/service.js
  21. 138
      source-linux/js/smiley.js
  22. 3
      source-linux/qml/calendarqml/CalendarTab.qml
  23. 3
      source-linux/qml/configqml/AccountPage.qml
  24. 5
      source-linux/qml/configqml/InfoBox.qml
  25. 57
      source-linux/qml/configqml/RegisterPage.qml
  26. 177
      source-linux/qml/contactqml/ContactDetailsComponent.qml
  27. 52
      source-linux/qml/contactqml/ContactsListTab.qml
  28. 169
      source-linux/qml/contactqml/ContactsSearchPage.qml
  29. 57
      source-linux/qml/contactqml/FriendsListTab.qml
  30. 16
      source-linux/qml/contactqml/FriendsTab.qml
  31. 120
      source-linux/qml/contactqml/GroupComponent.qml
  32. 24
      source-linux/qml/contactqml/GroupsListTab.qml
  33. 47
      source-linux/qml/friendiqa.qml
  34. 40
      source-linux/qml/genericqml/ContactComponent.qml
  35. 2
      source-linux/qml/genericqml/LeftDrawerLinux.qml
  36. 1
      source-linux/qml/genericqml/LinuxSync.qml
  37. 278
      source-linux/qml/genericqml/PermissionDialog.qml
  38. 6
      source-linux/qml/genericqml/Search.qml
  39. 52
      source-linux/qml/newsqml/ContactPage.qml
  40. 84
      source-linux/qml/newsqml/MessageSend.qml
  41. 2
      source-linux/qml/newsqml/NewsImage.qml
  42. 2
      source-linux/qml/newsqml/NewsPhotolist.qml
  43. 49
      source-linux/qml/newsqml/NewsStack.qml
  44. 5
      source-linux/qml/newsqml/NewsVideo.qml
  45. 77
      source-linux/qml/newsqml/NewsYplayer.qml
  46. 217
      source-linux/qml/newsqml/Newsitem.qml
  47. 2
      source-linux/qml/newsqml/SmileyDialog.qml
  48. 2
      source-linux/qml/photoqml/ImageUploadDialog.qml
  49. 493
      source-linux/qml/photoqml/PhotoTab.qml
  50. BIN
      source-linux/translations/friendiqa-de.qm
  51. 33
      source-linux/translations/friendiqa-de.ts
  52. BIN
      source-linux/translations/friendiqa-es.qm
  53. 217
      source-linux/translations/friendiqa-es.ts
  54. BIN
      source-linux/translations/friendiqa-hu.qm
  55. 229
      source-linux/translations/friendiqa-hu.ts
  56. BIN
      source-linux/translations/friendiqa-it.qm
  57. 217
      source-linux/translations/friendiqa-it.ts

@ -1,4 +1,16 @@
## v0.6.4
* Search for new contacts (hashtags, names)
* Filter contacts
* many new emojis
* Replaced Favorite button with Reply button due to buggy Favourite API
* View newsitem on website (works only in coversation view)
* Rebuild contacts handling due to buggy Contacts API
* Removed permissions for new messages due to buggy Contacts API
* Sync all accounts in background (not only active)
## v0.6.3
* Dark theme

@ -18,7 +18,7 @@ Currently supported:
* Search for news
* Click on hashtag in newsitem starts search for news with that word
* Only first photo attachment in post is shown, click for more images and fullscreen image
* Click on video or youtube video shows video fullscreen
* Click on video shows video fullscreen
* For news containing urls ending with mp3, mp4, avi, webm, ogg or to a Peertube instance: media can be played in the app
* Open links in external browser
* Click on contact photo for contact details and last news
@ -26,11 +26,11 @@ Currently supported:
* Click on post text opens conversation
* Deletion, Reposting, Answering of Posts
* Expand truncated news items
* Liking, disliking, favoriting
* Liking, disliking
* Attending for event posts
* Update fetches new posts (up to last 50) since last in local DB
* More shows older posts from local DB
* Create new Message with images or direct messages, Contact/Group access rights (can be stored), smileys
* Create new Message with images or direct messages,smileys
* Send image from Android gallery
* Send text or urls from other apps to Friendiqa
* Native Android image dialog
@ -48,13 +48,14 @@ Currently supported:
* Tabs for own profiles, friends, other contacts and groups
* Show profile(s) of user and change profile picture
* List of all known contacts with locally downloaded pictures
* Follow or unfoolow contacts
* Follow or unfollow contacts
* Search for new contacts according to topic
* Show follow requests; approve, deny, ignore requests
* Additional information, last messages and other functionality shown in news tab
* Show public and private pictures of contact (screenscraping of contact's website, works only with certain theme)
* Show public and private events of contact
* Show members of groups
* Open website of contact or connect page (for other contacts)
* Open website of contact
* Clean other contacts with no news
ToDo:
@ -66,8 +67,8 @@ ToDo:
Currently supported:
* Download public own images to local directory
* Upload public picture to album with descriptions, send from gallery
* Download public own images to local directory (API is currently broken)
* Upload public picture to album with descriptions, send from gallery (API is currently broken)
* Delete own pictures and albums on client and server
* Change name or album of existing picture
* Show albums in grid, show images in album in grid and fullscreen

@ -1,6 +1,6 @@
<?xml version="1.0"?>
<manifest package="org.qtproject.friendiqa" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="0.6.3" android:versionCode="29" android:installLocation="auto">
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="29"/>
<manifest package="org.qtproject.friendiqa" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="0.6.4" android:versionCode="30" android:installLocation="auto">
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="30"/>
<!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application.
Remove the comment if you do not require these default permissions. -->
@ -22,7 +22,7 @@
android:logo="@drawable/friendiqa">
<activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation|mcc|mnc|density"
android:name="androidnative.friendiqa.FriendiqaActivity"
android:label="Friendiqa" android:screenOrientation="unspecified" android:launchMode="singleInstance" android:taskAffinity="">
android:label="Friendiqa" android:screenOrientation="unspecified" android:launchMode="singleTask" android:taskAffinity="">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>

@ -13,7 +13,7 @@
TEMPLATE = app
TARGET = friendiqa
CONFIG += release
QT += qml quick gui widgets androidextras sql webview #webengine
QT += core core-private qml quick gui widgets sql androidextras #webengine webview
include(androidnative.pri/androidnative.pri)
@ -64,6 +64,7 @@ HEADERS += \
common/alarm.h
DISTFILES += \
android/gradle.properties \
qml/calendarqml/*.qml \
android/AndroidManifest.xml \
android/gradle/wrapper/gradle-wrapper.jar \
@ -72,6 +73,7 @@ DISTFILES += \
android/build.gradle \
android/gradle/wrapper/gradle-wrapper.properties \
android/gradlew.bat \
qml/configqml/ConfigAppearancePage.qml \
translations/*.ts \
translations/*.qm \
qml/*.qml \
@ -86,3 +88,6 @@ DISTFILES += \
ANDROID_EXTRA_LIBS = $$PWD/android/arm/libcrypto_1_1.so $$PWD/android/arm/libssl_1_1.so $$PWD/android/arm64/libcrypto_1_1.so $$PWD/android/arm64/libssl_1_1.so
#ANDROID_ABIS = arm64-v8a
#android: include(/home/pankraz/git/android_openssl/openssl.pri)
android: include(/home/pankraz/android-sdk/android_openssl/openssl.pri)

@ -75,7 +75,7 @@ ApplicationWindow{
function onLoginChanged(login){
if(login==""){rootstackView.push("qrc:/qml/configqml/AccountPage.qml")}
else{//rootstackView.push(rootstack)
else{
if (login.newsViewType!="" || login.newsViewType!=null){newstab.newstabstatus=login.newsViewType;}
Newsjs.getCurrentContacts(login,db,function(contacts){
contactlist=contacts})}
@ -117,7 +117,7 @@ ApplicationWindow{
}
function showContact(contact){ //print(JSON.stringify(contact));
function showContact(contact){
rootstackView.push("qrc:/qml/newsqml/ContactPage.qml",{"contact": contact})
}
@ -182,7 +182,7 @@ ApplicationWindow{
footer:ToolBar{id:roottoolbar
background: Rectangle{
anchors.fill: parent
color: Material.backgroundDimColor//"#EEEEEE"//"#F8F8F8"
color: Material.backgroundDimColor
}
TabBar {
@ -224,18 +224,6 @@ ApplicationWindow{
}
}
// states: State {
// name: "fullscreen";
// PropertyChanges { target: bar; height:0 }
// PropertyChanges { target: rootstack; height:parent.height }
// }
// transitions: Transition {
// PropertyAnimation { properties: "height";
// easing.type: Easing.InOutQuad
// duration: 1000
// }
// }
StackView{id:rootstackView
width:root.width
height: root.height
@ -250,6 +238,7 @@ ApplicationWindow{
property string newstabstatus
property var conversation:[]
source:(rootstack.currentIndex==0)? "qrc:/qml/newsqml/NewsTab.qml":""
//onDoubleClicked:{newstypeSignal("refresh")}
}
Loader{
id: friendstab

@ -1,9 +1,3 @@
# TEMPLATE = app
# TARGET = friendiqa
# CONFIG += release
# QT += qml quick gui widgets sql webview dbus webengine
cmake_minimum_required(VERSION 3.1.0)
project(friendiqa VERSION 0.6 LANGUAGES CXX)
@ -19,9 +13,7 @@ if(CMAKE_VERSION VERSION_LESS "3.7.0")
set(CMAKE_INCLUDE_CURRENT_DIR ON)
endif()
find_package(Qt5 COMPONENTS Widgets Quick Sql DBus WebView REQUIRED) #QuickWidgets
#Webview Webengine
find_package(Qt5 COMPONENTS Widgets Quick Sql DBus REQUIRED)
set(MOC_SOURCES common/uploadableimage.h
common/xhr.h
@ -37,7 +29,7 @@ set(SOURCES common/friendiqa.cpp
common/remoteauthasyncimageprovider.cpp
common/updatenews.cpp
common/alarmlinux.cpp)
include_directories(common)
add_executable(friendiqa ${SOURCES} ${MOC_SOURCES} application.qrc)
@ -46,52 +38,8 @@ target_link_libraries(friendiqa Qt::Core)
target_link_libraries(friendiqa Qt::Widgets)
target_link_libraries(friendiqa Qt::Quick)
target_link_libraries(friendiqa Qt::Sql)
target_link_libraries(friendiqa Qt::WebView)
target_link_libraries(friendiqa Qt::DBus)
#target_link_libraries(friendiqa Qt::QuickWidgets)
# target_link_libraries(friendiqa Qt::Webengine)
# qt5_use_modules(friendiqa Core Widgets Quick Sql DBus)
install(TARGETS friendiqa DESTINATION bin)
#RESOURCES = application.qrc
# OTHER_FILES += qml/friendiqa.qml \
# translations/*.ts \
# qml/*.qml
# qml/newsqml/*.qml
# qml/contactqml/*.qml
# qml/photoqml/*.qml
# qml/configqml/*.qml
# js/*.js
#TRANSLATIONS += translations/friendiqa-de.ts \
# translations/friendiqa-es.ts \
# translations/friendiqa-it.ts
# HEADERS += \
# common/uploadableimage.h \
# common/xhr.h \
# common/filesystem.h \
# common/remoteauthasyncimageprovider.h \
# common/updatenews.h \
# common/alarm.h
#DISTFILES += \
# qml/calendarqml/*.qml \
# translations/*.ts \
# translations/*.qm \
# qml/*.qml \
# qml/newsqml/*.qml \
# qml/contactqml/*.qml \
# qml/photoqml/*.qml \
# qml/configqml/*.qml \
# js/*.js \
# target.path=/usr/bin
# desktop.path = /usr/share/applications
# desktop.files = images/de.ma-nic.Friendiqa.desktop
# icon.path = /usr/share/icons/hicolor/scalable/apps
# icon.files = images/Friendiqa.svg
# INSTALLS+=target desktop icon
install(TARGETS friendiqa DESTINATION ${CMAKE_INSTALL_BINDIR})
install(FILES images/de.manic.Friendiqa.desktop DESTINATION share/applications)
install(FILES images/de.manic.Friendiqa.svg DESTINATION share/icons/hicolor/scalable/apps)

@ -13,7 +13,6 @@
<file>qml/newsqml/NewsVideo.qml</file>
<file>qml/newsqml/ContactPage.qml</file>
<file>qml/newsqml/NewsVideoLarge.qml</file>
<file>qml/newsqml/NewsYplayer.qml</file>
<file>qml/newsqml/SmileyDialog.qml</file>
<file>qml/contactqml/FriendsTab.qml</file>
<file>qml/contactqml/GroupComponent.qml</file>
@ -35,7 +34,6 @@
<file>qml/calendarqml/CalendarTab.qml</file>
<file>qml/calendarqml/CalendarDay.qml</file>
<file>qml/calendarqml/EventList.qml</file>
<file>qml/configqml/RegisterPage.qml</file>
<file>qml/configqml/AccountPage.qml</file>
<file>qml/configqml/SyncConfig.qml</file>
<file>qml/configqml/SyncComponent.qml</file>
@ -252,5 +250,7 @@
<file>images/Friendica_monochrome.png</file>
<file>qml/configqml/ConfigAppearancePage.qml</file>
<file>qml/configqml/ConfigStartPage.qml</file>
<file>qml/contactqml/ContactsSearchPage.qml</file>
<file>images/Friendiqa.ico</file>
</qresource>
</RCC>

@ -154,10 +154,8 @@ bool FILESYSTEM::isAutostart() {
QFileInfo check_file(QDir::homePath() + "/.config/autostart/friendiqa.desktop");
if (check_file.exists() && check_file.isFile()) {
qDebug()<<"autostart "<<true;
return true;
}
qDebug()<<"autostart "<<false;
return false;
}

@ -74,6 +74,7 @@ int main(int argc, char *argv[]) {
UPDATENEWS* updatenews= UPDATENEWS::instance();
updatenews->setDatabase();
updatenews->login();
updatenews->setSyncAll(true);
updatenews->startsync();
//app.connect (updatenews,SIGNAL(quitapp()),&app,SLOT(quit()));
@ -86,6 +87,7 @@ int main(int argc, char *argv[]) {
QQmlApplicationEngine view;
//QQuickView view;
//view.setResizeMode(QQuickView::SizeRootObjectToView);
app.setWindowIcon(QIcon(":/images/Friendiqa.ico"));
QTranslator qtTranslator;
qtTranslator.load("friendiqa-" + QLocale::system().name(),":/translations");
app.installTranslator(&qtTranslator);
@ -108,6 +110,7 @@ int main(int argc, char *argv[]) {
qmlRegisterType<QSystemTrayIcon>("QSystemTrayIcon", 1, 0, "QSystemTrayIcon");
qRegisterMetaType<QSystemTrayIcon::ActivationReason>("ActivationReason");
view.rootContext()->setContextProperty("iconTray", QIcon(":/images/Friendica_monochrome.png"));
view.rootContext()->setContextProperty("iconTrayAvailable", QSystemTrayIcon::isSystemTrayAvailable());
view.load(QUrl("qrc:/qml/friendiqa.qml"));
//view.show();

@ -32,7 +32,7 @@
#include "updatenews.h"
#include <QHttpPart>
#include <QTextCodec>
//#include <QTextCodec>
#include <QUrlQuery>
#include <QList>
#include <QDataStream>
@ -68,6 +68,10 @@ void UPDATENEWS::setUrl(QString url)
}
}
void UPDATENEWS::setSyncAll(bool syncAll)
{
m_syncAll=syncAll;
}
void UPDATENEWS::setDatabase()
{
@ -75,7 +79,6 @@ void UPDATENEWS::setDatabase()
QString db_url=qe.offlineStorageDatabaseFilePath("Friendiqa");
m_db = QSqlDatabase::addDatabase("QSQLITE");
m_db.setDatabaseName(QUrl("file://"+db_url+".sqlite").toLocalFile());
//qDebug() << db_url;
if (!m_db.open())
{
@ -86,26 +89,8 @@ void UPDATENEWS::setDatabase()
void UPDATENEWS::login()
{
QSqlQuery query("SELECT * FROM config WHERE isActive=0",m_db);
while (query.next())
{
username = query.value(1).toString();
QByteArray bpassword=query.value(2).toByteArray();
QString password=QByteArray::fromBase64(bpassword);
m_login=username+":"+password ;
xhr.setLogin(m_login);
m_url=query.value(0).toString();
xhr.setUrl(m_url);
m_imagedir=query.value(3).toString();
xhr.setImagedir(m_imagedir);
QString isActive=query.value(7).toString();
}
//m_updateInterval=query.value(5).toInt();
QSqlQuery syncquery("SELECT * FROM globaloptions",m_db);
// QSqlQuery delquery("DELETE FROM globaloptions WHERE k='sync_interval'",m_db);
// delquery.exec();
m_updateInterval=0;
syncindex=0;
synclist.clear();
@ -132,39 +117,61 @@ void UPDATENEWS::login()
if(!(synctimequery3.exec())) {qDebug() << " synctimequery3 " << synctimequery3.lastError();}
}
QSqlQuery query("SELECT * FROM config ORDER BY isActive ASC, username ASC",m_db);
query.last();
usernamelength=query.at()+1;
if (query.isActive()&&(usernameindex<usernamelength))
{ query.seek(usernameindex);
username = query.value(1).toString();
QByteArray bpassword=query.value(2).toByteArray();
QString password=QByteArray::fromBase64(bpassword);
m_login=username+":"+password ;
xhr.setLogin(m_login);
m_url=query.value(0).toString();
xhr.setUrl(m_url);
m_imagedir=query.value(3).toString();
xhr.setImagedir(m_imagedir);
QString isActive=query.value(7).toString();
}
}
void UPDATENEWS::startsync()
{ qDebug()<<"Friendiqa start syncing "<<syncindex <<" of "<<synclist.length(); //<< "Type "<<synclist[syncindex];
//QObject::connect(&xhr,SIGNAL(success(QByteArray,QString)),this,SLOT(store(QByteArray,QString)));
//QObject::connect(&xhr,SIGNAL(error(QString,QString,QString,int)),this,SLOT(showError(QString,QString,QString,int)));
if (syncindex<synclist.length()){
if (synclist[syncindex]=="sync_Timeline"){
timeline();
} else if (synclist[syncindex]=="sync_Replies") {
replies();
} else if (synclist[syncindex]=="sync_DirectMessages") {
directmessages();
} else if (synclist[syncindex]=="sync_Notifications") {
notifications();
} else if (synclist[syncindex]=="sync_FriendRequests") {
friendrequests();
}else if (synclist[syncindex]=="sync_Events") {
events();
}
} else if (syncindex==synclist.length()) {
m_api="";
if(m_updateInterval!=0){
syncindex=0;
synclist.clear();
m_db.close();
m_db.removeDatabase(m_db.connectionName());
QObject::disconnect(&xhr,SIGNAL(error(QString,QString,QString,int)),this,SLOT(showError(QString,QString,QString,int)));
emit quitapp();
alarm.setAlarm(m_updateInterval);
m_updateInterval=0;
}
}
{ //qDebug()<<"Friendiqa start syncing "<<syncindex <<" of "<<synclist.length() << " m_login "<<m_login;
if (syncindex<synclist.length()){
if (synclist[syncindex]=="sync_Timeline"){
timeline();
} else if (synclist[syncindex]=="sync_Replies") {
replies();
} else if (synclist[syncindex]=="sync_DirectMessages") {
directmessages();
} else if (synclist[syncindex]=="sync_Notifications") {
notifications();
} else if (synclist[syncindex]=="sync_FriendRequests") {
friendrequests();
}else if (synclist[syncindex]=="sync_Events") {
events();
}
} else if ((syncindex==synclist.length())&&(!(usernameindex<usernamelength-1))) {
m_api="";
if(m_updateInterval!=0){
syncindex=0;
usernameindex=0;
synclist.clear();
m_db.close();
m_db.removeDatabase(m_db.connectionName());
QObject::disconnect(&xhr,SIGNAL(error(QString,QString,QString,int)),this,SLOT(showError(QString,QString,QString,int)));
emit quitapp();
alarm.setAlarm(m_updateInterval);
m_updateInterval=0;
}
}
else{
usernameindex+=1;
login();
startsync();
}
}
@ -229,7 +236,7 @@ void UPDATENEWS::directmessages()
void UPDATENEWS::notifications()
{
m_api="/api/friendica/notifications";
m_api="/api/friendica/notification";
xhr.clearParams();
xhr.setUrl(m_url);
xhr.setApi(m_api);
@ -282,14 +289,14 @@ void UPDATENEWS::store(QByteArray serverreply,QString apiname)
for (int i=0; i < news.array().count();i++){
QJsonValue newsitem=news[i];
try{
if (apiname=="/api/friendica/notifications"){
if (apiname=="/api/friendica/notification"){
QSqlQuery testquery("SELECT status_id FROM news WHERE status_id=" + QString::number(newsitem["id"].toInt()) + " AND messagetype=2 AND username='"+ username +"'",m_db);
if (testquery.first()) {continue;}
}
QSqlQuery query(m_db);
query.prepare("INSERT INTO news (username,messagetype,text,created_at,in_reply_to_status_id,source,status_id,in_reply_to_user_id,"
"geo,favorited,uid,statusnet_html,statusnet_conversation_id,friendica_activities,friendica_activities_self,attachments,friendica_owner) "
"VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
"geo,favorited,uid,statusnet_html,statusnet_conversation_id,friendica_activities,friendica_activities_self,attachments,friendica_owner) "
"VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
query.bindValue(0,username);
query.bindValue(1,"0");
query.bindValue(2, newsitem["text"].toString().toUtf8().toBase64());
@ -303,10 +310,11 @@ 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());
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());}
//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());//}
if (newsitem["statusnet_conversation_id"].isDouble()){
query.bindValue(12, newsitem["statusnet_conversation_id"].toInt());
}else{query.bindValue(12, newsitem["statusnet_conversation_id"].toString());}
@ -351,14 +359,14 @@ void UPDATENEWS::store(QByteArray serverreply,QString apiname)
if (apiname == "/api/direct_messages/all"){
query.bindValue(1,"1");
query.bindValue(5,"Friendica");
query.bindValue(6,newsitem["id"].toString().toInt());
query.bindValue(6,newsitem["id"].toInt());
if(newsitem["recipient"]["id"]!=QJsonValue::Null){ query.bindValue(7,newsitem["recipient"]["id"].toInt());}
query.bindValue(10, newsitem["sender_id"].toInt());
query.bindValue(11, newsitem["text"].toString().toUtf8().toBase64());
if(newsitem["friendica_parent_uri"]!=QJsonValue::Null){ query.bindValue(12,newsitem["friendica_parent_uri"]);}
query.bindValue(16, newsitem["sender"]["url"]);
}
if (apiname == "/api/friendica/notifications"){
if (apiname == "/api/friendica/notification"){
query.bindValue(1,"2");
query.bindValue(3,QDateTime::fromString(newsitem["date"].toString(),"yyyy-MM-dd hh:mm:ss").toMSecsSinceEpoch());
query.bindValue(5,"Friendica");
@ -387,7 +395,7 @@ void UPDATENEWS::store(QByteArray serverreply,QString apiname)
alarm.notify("DirectMessage: "+newsitem["sender"]["name"].toString(),newsitem["text"].toString(),2);
}
}
if (apiname=="/api/friendica/notifications"){
if (apiname=="/api/friendica/notification"){
if(notifylist.contains("notify_Notifications")){
alarm.notify("Notification: "+newsitem["name"].toString(),newsitem["text"].toString(),3);
}
@ -403,7 +411,7 @@ void UPDATENEWS::store(QByteArray serverreply,QString apiname)
startImagedownload("contactlist");
} else {
if(m_updateInterval!=0){
if((m_updateInterval!=0) && m_syncAll){
syncindex+=1;
startsync();
}
@ -411,9 +419,12 @@ void UPDATENEWS::store(QByteArray serverreply,QString apiname)
}
else {
qDebug()<< "Friendiqa updatenews error " << serverreply;
emit this->error(m_api,QTextCodec::codecForName("utf-8")->toUnicode(serverreply));
syncindex+=1;
startsync();
//emit this->error(m_api,QTextCodec::codecForName("utf-8")->toUnicode(serverreply));
emit this->error(m_api,QString(serverreply));
if(m_syncAll){
syncindex+=1;
startsync();
}
}
}
@ -428,10 +439,11 @@ void UPDATENEWS::updateImageLocation(QString downloadtype,QString imageurl, QStr
testquery.first();
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();}
//qDebug()<< "index " << index << " " << newcontactnames.length()-1 << " " << m_syncAll;
if (index==(newcontactnames.length()-1)){
newcontactnames.clear();
newcontactimagelinks.clear();
if(m_updateInterval!=0){
if((m_updateInterval!=0) && m_syncAll){
syncindex+=1;
startsync();
}
@ -445,7 +457,7 @@ void UPDATENEWS::updateImageLocation(QString downloadtype,QString imageurl, QStr
if (index==(newcontactnames.length()-1)){
newcontactnames.clear();
newcontactimagelinks.clear();
if(m_updateInterval!=0){
if((m_updateInterval!=0) && m_syncAll){
syncindex+=1;
startsync();
}
@ -537,10 +549,10 @@ void UPDATENEWS::updateContacts(QList<QJsonValue> contacts){
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=?,"
"profile_image_url=?, description=?, protected=?, followers_count=?,"
"friends_count=?, created_at=?, favourites_count=?, utc_offset=?, time_zone=?, statuses_count=?,"
"following=?, verified=?, statusnet_blocking=?, notifications=?, statusnet_profile_url=?, cid=?, network=?, timestamp=? "
" WHERE username='"+ username +"' AND url='" + contact["url"].toString() +"'");
"profile_image_url=?, description=?, protected=?, followers_count=?,"
"friends_count=?, created_at=?, favourites_count=?, utc_offset=?, time_zone=?, statuses_count=?,"
"following=?, verified=?, statusnet_blocking=?, notifications=?, statusnet_profile_url=?, cid=?, network=?, timestamp=? "
" WHERE username='"+ username +"' AND url='" + contact["url"].toString() +"'");
query.bindValue(0, contact["id"].toInt());
query.bindValue(1, contact["name"].toString().toUtf8().toBase64());
query.bindValue(2, contact["screen_name"]);
@ -573,10 +585,10 @@ void UPDATENEWS::updateContacts(QList<QJsonValue> contacts){
else{
query.prepare("INSERT INTO contacts (username, id, name, screen_name, location,imageAge,"
"profile_image_url, description, profile_image, url, protected, followers_count,"
"friends_count, created_at, favourites_count, utc_offset, time_zone, statuses_count,"
"following, verified, statusnet_blocking, notifications, statusnet_profile_url, cid, network, isFriend, timestamp)"
"VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
"profile_image_url, description, profile_image, url, protected, followers_count,"
"friends_count, created_at, favourites_count, utc_offset, time_zone, statuses_count,"
"following, verified, statusnet_blocking, notifications, statusnet_profile_url, cid, network, isFriend, timestamp)"
"VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
query.bindValue(0,username);
query.bindValue(1, contact["id"].toInt());
@ -628,6 +640,7 @@ void UPDATENEWS::storeFriendrequests(QByteArray serverreply,QString apiname)
QSqlQuery imagequery("SELECT avatar FROM friendshiprequests",m_db);
QList<QString> imageurls;
while (imagequery.next()){
imageurls.append(imagequery.value(0).toString());
}
@ -639,10 +652,10 @@ void UPDATENEWS::storeFriendrequests(QByteArray serverreply,QString apiname)
QSqlQuery query(m_db);
if (testquery.first()){
query.prepare("UPDATE friendshiprequests SET id=?, usernamef=?, acct=?, display_name=?,locked=?,"
"bot=?, discoverable=?, groupf=?, created_at=?,"
"note=?, avatar=?, header=?, header_static=?, followers_count=?,"
"following_count=?, statuses_count=?, last_status_at=?, emojis=?, fields=? "
" WHERE username='"+ username +"' AND url='" + friendrequestitem["url"].toString() +"'");
"bot=?, discoverable=?, groupf=?, created_at=?,"
"note=?, avatar=?, header=?, header_static=?, followers_count=?,"
"following_count=?, statuses_count=?, last_status_at=?, emojis=?, fields=? "
" WHERE username='"+ username +"' AND url='" + friendrequestitem["url"].toString() +"'");
query.bindValue(0, friendrequestitem["id"].toInt());
query.bindValue(1, friendrequestitem["username"]);
@ -667,9 +680,9 @@ void UPDATENEWS::storeFriendrequests(QByteArray serverreply,QString apiname)
else{
query.prepare("INSERT INTO friendshiprequests (username, id, usernamef, acct, display_name, locked,"
" created_at, followers_count, following_count, statuses_count, note, url, avatar, avatar_static, "
"header, header_static, emojis, moved, fields, bot, groupf, discoverable, last_status_at) "
"VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
" created_at, followers_count, following_count, statuses_count, note, url, avatar, avatar_static, "
"header, header_static, emojis, moved, fields, bot, groupf, discoverable, last_status_at) "
"VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
query.bindValue(0, username);
query.bindValue(1, friendrequestitem["id"].toInt());
query.bindValue(2, friendrequestitem["username"].toString());
@ -710,13 +723,12 @@ void UPDATENEWS::storeFriendrequests(QByteArray serverreply,QString apiname)
newcontactimagelinks.append(friendrequestitem["avatar"].toString());
newcontactnames.append(friendrequestitem["username"].toString());
}
}
if (newcontactimagelinks.length()>0){
//qDebug() << "start Friendrequests imagedownload";
startImagedownload("friendrequests");
}else{
if(m_updateInterval!=0){
if((m_updateInterval!=0) && m_syncAll){
syncindex+=1;
startsync();
}
@ -769,7 +781,7 @@ void UPDATENEWS::storeEvents(QByteArray serverreply,QString apiname)
alarm.notify("Event: "+ QDateTime::fromMSecsSinceEpoch(eventnotifyquery.value(0).toLongLong()).toString("dd.MM.yyyy hh:mm"),eventnotifyquery.value(1).toString(),1);
}
}
if(m_updateInterval!=0){
if((m_updateInterval!=0) && m_syncAll){
syncindex+=1;
startsync();
}
@ -795,7 +807,7 @@ void UPDATENEWS::showError(QString data, QString url,QString api, int code )
//qDebug() << "showerror " << api << " data " << data;
emit this->error(api,data);
if (api!=m_api || xhr.downloadtype()!=""){} else{
if(m_updateInterval!=0){
if((m_updateInterval!=0) && m_syncAll){
syncindex+=1;
startsync();
}

@ -61,6 +61,7 @@ signals:
public slots:
void setUrl(QString url);
void setSyncAll(bool syncAll);
void setDatabase();
void login();
void timeline();
@ -84,7 +85,10 @@ private:
QString m_imagedir;
QString m_login;
QString username;
bool m_syncAll;
int syncindex;
int usernameindex;
int usernamelength;
QSqlDatabase m_db;
QList<QString> synclist;
QList <QString> notifylist;

@ -32,10 +32,11 @@
#include "xhr.h"
#include <QHttpPart>
#include <QTextCodec>
//#include <QTextCodec>
#include <QUrlQuery>
#include <QList>
#include <QDataStream>
#include <QFile>
#include <QJsonDocument>
#include <QJsonObject>
#include "uploadableimage.h"
@ -223,7 +224,7 @@ void XHR::getlist()
XHR::setUrl(m_filelist.at(dlindex));}
else {
XHR::setUrl(m_filelist.at(dlindex));}
qDebug() << "start download" << m_url;
//qDebug() << "start download" << m_url;
XHR::download();
} else {dlindex=0;m_downloadtype="";m_contactlist.clear();m_filelist.clear();}
}
@ -291,7 +292,6 @@ void XHR::onReplySuccess()
void XHR::onRequestFinished()
{
qDebug()<<"download requestFinished ";
// Save the file here
if (buffer.isNull()){qDebug() << "File empty"<<m_url; buffer.clear(); emit this->error(m_downloadtype,m_url,m_api,1);}
else if (m_downloadtype=="picturelist") {
@ -359,5 +359,6 @@ void XHR::onSSLError(const QList<QSslError> &errors)
QString XHR::bufferToString()
{
return QTextCodec::codecForName("utf-8")->toUnicode(buffer);
//return QTextCodec::codecForName("utf-8")->toUnicode(buffer);
return QString(buffer);
}

@ -37,7 +37,7 @@
#include <QNetworkRequest>
#include <QObject>
#include <QJsonObject>
#include <QNetworkConfiguration>
//#include <QNetworkConfiguration>
class XHR : public QObject
{

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

@ -2,7 +2,7 @@
Version=1.0
Type=Application
Exec=friendiqa %u
Icon=Friendiqa.svg
Icon=de.manic.Friendiqa.svg
Terminal=false
Name=Friendiqa
GenericName=Social Media

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

@ -62,11 +62,13 @@ function friendicaPostRequest(login,api,data,method,rootwindow,callback) {
try{ if (xhrequest.responseText!=""){
callback(xhrequest.responseText)
}else{//print("API:\n" +api+" NO RESPONSE");
showMessage("Error","API:\n" +api+" NO RESPONSE",rootwindow)
//showMessage("Error","API:\n" +api+" NO RESPONSE",rootwindow)
callback(xhrequest.responseText)
}
}
catch (e){print("API:\n" + api+" "+e+"\n Return:"+xhrequest.responseText);showMessage("Error", "API:\n" + api+" "+e+"\n Return:"+xhrequest.responseText,rootwindow)}
catch (e){
print("API:\n" + api+" "+e+"\n Return:"+xhrequest.responseText);
showMessage("Error", "API:\n" + api+" "+e+"\n Return:"+xhrequest.responseText,rootwindow)}
}
}
xhrequest.open(method, login.server+api,true,login.username,Qt.atob(login.password));

@ -34,51 +34,77 @@
.import "qrc:/js/helper.js" as Helperjs
function requestFriends(login,database,rootwindow,callback){
// return array of friends
// return array of friends
var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]);
db.transaction( function(tx) {
var result = tx.executeSql('UPDATE contacts SET isFriend=0 where username="'+login.username+'"')}); // clean old friends
Helperjs.friendicaRequest(login,"/api/statuses/friends?count=9999", rootwindow,function (obj){
var friends=JSON.parse(obj);
for (var i=0;i<friends.length;i++){
friends[i].created_at=Date.parse(cleanDate(friends[i].created_at));
friends[i].isFriend=1
}
//try{requestProfile(login,friends,rootwindow,function(friends_profile){callback(friends_profile)})}
//catch(e){
callback(friends)//}
var result = tx.executeSql('UPDATE contacts SET isFriend=0 where username="'+login.username+'"'); // clean old friends
var result2 = tx.executeSql('DELETE from groups where username="'+login.username+'"'); // clean old groups
})
// /api/statuses/friends not working in Friendica 2/2022 , switching to api/v1/lists and download of all list members
// Helperjs.friendicaRequest(login,"/api/statuses/friends?count=9999", rootwindow,function (obj){
var allfriends=[];
Helperjs.friendicaRequest(login,"/api/v1/lists",rootwindow,function(listsobj){
var lists=JSON.parse(listsobj)
for (var list in lists){
Helperjs.friendicaRequest(login,"/api/v1/lists/"+lists[list].id+"/accounts?limit=0", rootwindow,function (obj){
var friends=JSON.parse(obj);
var memberarray=[];
for (var i=0;i<friends.length;i++){
if (friends[i].note!=null){
friends[i].description=friends[i].note;}
else{friends[i].description=""}
friends[i].name=friends[i].display_name;
friends[i].screen_name=friends[i].acct;
friends[i].location="";
friends[i].profile_image=friends[i].avatar_static;
friends[i].profile_image_url=friends[i].avatar;
friends[i].protected=false;
friends[i].friends_count=friends[i].following_count;
friends[i].created_at=Date.parse(friends[i].created_at);
friends[i].favorites_count=0;
friends[i].utc_offset=0;
friends[i].isFriend=1
friends[i].cid=0
friends[i].following=true
memberarray.push(parseInt(friends[i].id))
}
//requestGroups() not working with Friendica 02/2022
db.transaction( function(tx) {
var result3 = tx.executeSql('INSERT INTO groups VALUES (?,?,?,?)', [login.username,lists[list].title,lists[list].id,JSON.stringify(memberarray)])
})
callback(friends)
})};
});
}
function requestGroups(login,database,rootwindow,callback){
// retrieve, save and return groups. Other features currently not implemented
// retrieve, save and return groups. Other features currently not implemented
var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]);
Helperjs.friendicaRequest(login,"/api/friendica/group_show",rootwindow, function (obj){
var groups=JSON.parse(obj);
var groups=JSON.parse(obj);
db.transaction( function(tx) {
var result = tx.executeSql('DELETE from groups where username="'+login.username+'"'); // clean old groups
for (var i=0;i<groups.length;i++){
var memberarray=[]; for (var user in groups[i].user){memberarray.push(parseInt(groups[i].user[user].id))}
//print("Members: "+groups[i].user)
var result2 = tx.executeSql('INSERT INTO groups VALUES (?,?,?,?)', [login.username,groups[i].name,groups[i].gid,JSON.stringify(memberarray)])}
callback()
var result = tx.executeSql('DELETE from groups where username="'+login.username+'"'); // clean old groups
for (var i=0;i<groups.length;i++){
var memberarray=[]; for (var user in groups[i].user){memberarray.push(parseInt(groups[i].user[user].id))}
//print("Members: "+groups[i].user)
var result2 = tx.executeSql('INSERT INTO groups VALUES (?,?,?,?)', [login.username,groups[i].name,groups[i].gid,JSON.stringify(memberarray)])}
callback()
});
})}
})}
function listFriends(login,database,callback,filter){
function listFriends(login,database,callback,filter,isFriend=0){
var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]);
var filtertext='';
//try {filtertext=' AND screen_name like "' + filter+'%"'}catch(e){}
var filtertext=new RegExp(".*"+filter.toLowerCase()+".*")
// if (filter){filtertext=' AND (screen_name like "' + filter+'%" OR name like "' + Qt.btoa(filter)+'%")'}
if (filter!=null){var filtertext=new RegExp(".*"+filter.toLowerCase()+".*")}else{var filtertext=new RegExp(".*")}
db.transaction( function(tx) {
//var result = tx.executeSql('SELECT * from contacts WHERE username="'+login.username+'" AND isFriend>0'+filtertext);
var result = tx.executeSql('SELECT * from contacts WHERE username="'+login.username+'" AND isFriend>0');
var result = tx.executeSql('SELECT * from contacts WHERE username="'+login.username+'" AND isFriend>'+isFriend+' ORDER BY screen_name');
// check for friends
var contactlist=[];
for (var i=0;i<result.rows.length;i++){
var contact=result.rows.item(i)
contact.name=Qt.atob(contact.name);
if (contact.screen_name==null){contact.screen_name=""}
if(filtertext.test(contact.name.toLowerCase())|| filtertext.test(contact.screen_name.toLowerCase())){
contactlist.push(contact)}
}
@ -108,7 +134,7 @@ function storeHashtags(login,database,newstext,rootwindow){
for (var tag in hashtags){
db.transaction( function(tx) {
var result = tx.executeSql('SELECT * from hashtags where username="'+login.username+'" AND tag = "'+Qt.btoa(tag)+'"'); // check for tag
if(result.rows.length === 1) {// use update
if(result.rows.length > 0) {// use update
result = tx.executeSql('UPDATE hashtags SET tag="'+'", date='+curDate+', ownership=0 where username="'+login.username+'" AND tag="'+Qt.btoa(hashtags[tag])+'"');
} else {// use insert
result = tx.executeSql('INSERT INTO hashtags (username,tag,date,statuses,ownership) VALUES (?,?,?,?,?)', [login.username,Qt.btoa(hashtags[tag]),curDate,"[]",0])
@ -122,20 +148,20 @@ function deleteGroup(login,database,rootwindow,group, callback){
Helperjs.friendicaPostRequest(login,"/api/friendica/group_delete?gid="+group.gid+"&name="+group.groupname,"","POST",rootwindow, function (obj){
var deletereturn=JSON.parse(obj);
if(deletereturn.success){
db.transaction( function(tx) {
var result = tx.executeSql('DELETE from groups where username="'+login.username+'" AND groupname="'+group.name+'"'); // delete group
callback()
});
}})}
db.transaction( function(tx) {
var result = tx.executeSql('DELETE from groups where username="'+login.username+'" AND groupname="'+group.name+'"'); // delete group
callback()
});
}})}
function getLastNews(login,database,callback){
var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]);
var lastnewsid=0;
db.transaction( function(tx) {
var result = tx.executeSql('SELECT status_id from news WHERE username="'+login.username+'" AND messagetype=0 ORDER BY status_id DESC LIMIT 1');
try{lastnewsid=result.rows.item(0).status_id;}catch(e){lastnewsid=0};
callback(lastnewsid)
})
var result = tx.executeSql('SELECT status_id from news WHERE username="'+login.username+'" AND messagetype=0 ORDER BY status_id DESC LIMIT 1');
try{lastnewsid=result.rows.item(0).status_id;}catch(e){lastnewsid=0};
callback(lastnewsid)
})
}
@ -163,15 +189,15 @@ function getCurrentContacts(login,database,callback){
db.transaction( function(tx) {
var result = tx.executeSql('SELECT url from contacts WHERE username="'+login.username+'" AND isFriend=1'); // check for friends
for (var i=0;i<result.rows.length;i++){
contactlist.push(result.rows.item(i).url )
//print(result.rows.item(i).url)
}
var lastDate=Date.now()-604800000;// 7 days old
//print('SELECT url from contacts WHERE username="'+login.username+'" AND isFriend=0 AND imageAge>'+lastDate);
var result2 = tx.executeSql('SELECT url from contacts WHERE username="'+login.username+'" AND isFriend=0 AND imageAge > '+lastDate);
for (var j=0;j<result2.rows.length;j++){
contactlist.push(result2.rows.item(j).url )
}
contactlist.push(result.rows.item(i).url )
//print(result.rows.item(i).url)
}
var lastDate=Date.now()-604800000;// 7 days old
//print('SELECT url from contacts WHERE username="'+login.username+'" AND isFriend=0 AND imageAge>'+lastDate);
var result2 = tx.executeSql('SELECT url from contacts WHERE username="'+login.username+'" AND isFriend=0 AND imageAge > '+lastDate);
for (var j=0;j<result2.rows.length;j++){
contactlist.push(result2.rows.item(j).url )
}
})
callback(contactlist)
}
@ -183,7 +209,7 @@ function findNewContacts(news,contacts){
if(contacts.indexOf(url)==-1 && !(inArray(newContacts,"url",url))){
news[i].user.isFriend=0;
newContacts.push(news[i].user);
}
}
if (news[i].hasOwnProperty('friendica_activities') && news[i].friendica_activities.like.length>0){
for (var j=0;j<news[i].friendica_activities.like.length;j++){
var like_url=news[i].friendica_activities.like[j].url;
@ -192,47 +218,48 @@ function findNewContacts(news,contacts){
newContacts.push(news[i].friendica_activities.like[j]);
}
}
}
if (news[i].hasOwnProperty('friendica_activities') && news[i].friendica_activities.dislike.length>0){
}
if (news[i].hasOwnProperty('friendica_activities') && news[i].friendica_activities.dislike.length>0){
for (var k=0;j<news[k].friendica_activities.dislike.length;k++){
var dislike_url=news[i].friendica_activities.dislike[k].url;
if(contacts.indexOf(dislike_url)==-1 && !(inArray(newContacts,"url",dislike_url))){
news[i].friendica_activities.dislike[k].isFriend=0;
newContacts.push(news[i].friendica_activities.dislike[k]);
newContacts.push(news[i].friendica_activities.dislike[k]);
}
}
}
if(news[i].hasOwnProperty('friendica_author')){
var owner_url=news[i].friendica_author.url;
if(contacts.indexOf(owner_url)==-1 && !(inArray(newContacts,"url",owner_url))){
news[i].friendica_author.isFriend=0;
newContacts.push(news[i].friendica_author);
}
}
}
if(news[i].hasOwnProperty('friendica_author')){
var owner_url=news[i].friendica_author.url;
if(contacts.indexOf(owner_url)==-1 && !(inArray(newContacts,"url",owner_url))){
news[i].friendica_author.isFriend=0;
newContacts.push(news[i].friendica_author);
}
}
}
return newContacts
}
function storeNews(login,database,news,rootwindow){
// save news after contacts download, call next function
// save news after contacts download, call next function
var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]);
for (var i=0;i<news.length;i++){
//print('store news data for ' + login.username+news[i].messagetype+Qt.btoa(news[i].text)+news[i].created_at+ news[i].in_reply_to_status_id+ news[i].source+ news[i].id+news[i].in_reply_to_user_id+news[i].geo+news[i].favorited+ news[i].user.id+Qt.btoa(news[i].statusnet_html)+news[i].statusnet_conversation_id+ Qt.btoa(JSON.stringify(friendica_activities))+"[]"+attachments+news[i].friendica_author.url);
//var ausdruck=news[i];
var likearray=[];var dislikearray=[];var attendyesarray=[];var attendnoarray=[];var attendmaybearray=[];
if(news[i].hasOwnProperty('friendica_activities')){
for (var user in news[i].friendica_activities.like){likearray.push(news[i].friendica_activities.like[user].url)}
for (var user in news[i].friendica_activities.dislike){dislikearray.push(news[i].friendica_activities.dislike[user].url)}
for (var user in news[i].friendica_activities.attendyes){attendyesarray.push(news[i].friendica_activities.attendyes[user].url)}
for (var user in news[i].friendica_activities.attendno){attendnoarray.push(news[i].friendica_activities.attendno[user].url)}
for (var user in news[i].friendica_activities.attendmaybe){attendmaybearray.push(news[i].friendica_activities.attendmaybe[user].url)}
for (var user in news[i].friendica_activities.like){likearray.push(news[i].friendica_activities.like[user].url)}
for (var user in news[i].friendica_activities.dislike){dislikearray.push(news[i].friendica_activities.dislike[user].url)}
for (var user in news[i].friendica_activities.attendyes){attendyesarray.push(news[i].friendica_activities.attendyes[user].url)}
for (var user in news[i].friendica_activities.attendno){attendnoarray.push(news[i].friendica_activities.attendno[user].url)}
for (var user in news[i].friendica_activities.attendmaybe){attendmaybearray.push(news[i].friendica_activities.attendmaybe[user].url)}
}
var friendica_activities=[likearray,dislikearray,attendyesarray,attendnoarray,attendmaybearray]
var attachments="";if (news[i].attachments){attachments=Qt.btoa(JSON.stringify(news[i].attachments))}
if (news[i].friendica_title!="") {news[i].statusnet_html="<b>"+news[i].friendica_title +"</b><br><br>"+news[i].friendica_html;}
else{news[i].statusnet_html=news[i].friendica_html}
//if (news[i].friendica_title!="") {news[i].statusnet_html="<b>"+news[i].friendica_title +"</b><br><br>"+news[i].friendica_html;}
//else{
news[i].statusnet_html=news[i].friendica_html//}
db.transaction( function(tx) {
var result = tx.executeSql('SELECT * from news where username="'+login.username+'" AND status_id = "'+news[i].id+'" AND messagetype='+news[i].messagetype); // check for news id
@ -241,20 +268,20 @@ function storeNews(login,database,news,rootwindow){
result = tx.executeSql('UPDATE news SET username="'+login.username+'", messagetype='+news[i].messagetype+', text="'+Qt.btoa(news[i].text)+'", created_at="'+news[i].created_at+'", in_reply_to_status_id="'+news[i].in_reply_to_status_id+'", source="'+news[i].source+'", status_id="'+news[i].id+'", in_reply_to_user_id="'+news[i].in_reply_to_user_id+'", geo="'+news[i].geo+'", favorited="'+news[i].favorited+'", uid="'+news[i].user.id+'", statusnet_html="'+Qt.btoa(news[i].statusnet_html)+'", statusnet_conversation_id="'+news[i].statusnet_conversation_id+'",friendica_activities="'+Qt.btoa(JSON.stringify(friendica_activities))+'",attachments="'+attachments+'",friendica_owner="'+news[i].<