This commit is contained in:
LubuWest 2018-11-09 22:06:13 +01:00
commit aca94a5393
98 changed files with 1061 additions and 152 deletions

View file

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify

View file

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
@ -151,7 +151,7 @@ var where = " AND "+ filter +" = '" + filtervalue+"'";
});
}
function showMessage(header,message,rootwindow){
function showMessage(header,message,rootwindow){print(message);
var cleanmessage=message.replace(/"/g,"-");
if(cleanmessage.length>200){cleanmessage=cleanmessage.slice(0,200)+'...'}
var messageString='import QtQuick 2.0; import QtQuick.Dialogs 1.2; MessageDialog{ visible: true; title:"'+header+'";standardButtons: StandardButton.Ok; text:" '+cleanmessage+'"}';

View file

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
@ -175,7 +175,6 @@ function deleteContacts(database,user,callback) { // does nothing useful at the
function newRequestFriendsAlbumPictures(login,friend,rootwindow,callback){
// screenscraping of albums page of contact with remoteAuth
Helperjs.friendicaRemoteAuthRequest(login,friend.url.replace("profile","photos"),friend.url,rootwindow,function(photohtml){
//print("Photohtml: "+photohtml);
try {var obj=JSON.parse(photohtml);
if (obj.hasOwnProperty('status')){
Helperjs.friendicaWebRequest(friend.url.replace("profile","photos"),rootwindow,function(photohtml){

View file

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify

View file

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
@ -465,7 +465,7 @@ function chatsfromdb(database,user,callback,stop_time){
helpernews.statusnet_html=Qt.atob(helpernews.statusnet_html);
helpernews.text=Qt.atob(helpernews.text);
helpernews.id=helpernews.status_id;
if (helpernews.attachments!==null){helpernews.attachments=JSON.parse(Qt.atob(helpernews.attachments))};
if (helpernews.attachments!==null){print(Qt.atob(helpernews.attachments));helpernews.attachments=JSON.parse(Qt.atob(helpernews.attachments))};
newsArray.push(helpernews);
}
callback(newsArray);

View file

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
@ -31,7 +31,7 @@
function findend (text, startpos) {
var indexOf = text.substring(startpos || 0).search(/\s/);
return (indexOf >= 0) ? (indexOf + (startpos || 0)) : indexOf;
return (indexOf >= 0) ? (indexOf + (startpos || 0)) : text.length;
}
@ -135,6 +135,20 @@ else{
if ((attachmentList.length==0) || (attachmentList[attachmentList.length-1].url!=ptvideohelper.url)){attachmentList.push(ptvideohelper)}
}
}
// if (newsitemobject.text.indexOf(".html")>-1){
// //print("message "+msg.options.showWebsiteForLinks);
// if (msg.options.showWebsiteForLinks!="false"){
// var linkhelper={mimetype:"text/html"}
// var linktext=newsitemobject.text;
// while (linktext.indexOf(".html")>-1){
// var linkhelperstringposition=linktext.indexOf(".html");
// var linkposend=findend(linktext,linkhelperstringposition);
// linkhelper.url=linktext.substring(linktext.lastIndexOf("http",linkhelperstringposition),linkposend);
// linktext=linktext.substring(linkhelperstringposition+5,linktext.length)
// if ((attachmentList.length==0) || (attachmentList[attachmentList.length-1].url!=linkhelper.url)){attachmentList.push(linkhelper)}
// }
// }
// }
newsitemobject.attachmentList=attachmentList;

View file

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify

View file

@ -1,4 +1,5 @@
// This file is part of Friendiqa // https://github.com/lubuwest/Friendiqa
// This file is part of Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
@ -48,6 +49,7 @@ function initDatabase(database) { // initialize the database object
tx.executeSql('CREATE TABLE IF NOT EXISTS profiles(username TEXT, id INT, profiledata TEXT)');
tx.executeSql('CREATE TABLE IF NOT EXISTS groups(username TEXT, groupname TEXT, gid INT, members TEXT)');
tx.executeSql('CREATE TABLE IF NOT EXISTS events(username TEXT, id INT, start INT, end INT, allday INT, title TEXT, j INT, d TEXT, isFirst INT, uid INT, cid INT, uri TEXT, created INT, edited INT, desc TEXT, location TEXT, type TEXT, nofinish TEXT, adjust INT, ignore INT, permissions TEXT, guid INT, itemid INT, plink TEXT, authorName TEXT, authorAvatar TEXT, authorLink TEXT, html TEXT)');
tx.executeSql('CREATE TABLE IF NOT EXISTS globaloptions(k TEXT, v TEXT)')
})}
function cleanPermissions(oldperms){
@ -293,6 +295,31 @@ function readActiveConfig(database){
return obj;
}
function readGlobaloptions(database,callback){
var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]);
var go=({});
db.transaction( function(tx) {
var rs = tx.executeSql('select * from globaloptions');
for (var r=0; r<rs.rows.length; r++){
go[rs.rows.item(r).k]=rs.rows.item(r).v
}
callback(go)
})
}
function updateglobaloptions(database,key,value){
var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]);
db.transaction( function(tx) {
var result = tx.executeSql('SELECT * from globaloptions where k="'+key+'"'); // check for key
if(result.rows.length === 1) {// use update
result = tx.executeSql('UPDATE globaloptions SET v="'+value+'" WHERE k="'+key+'"')
} else {// use insert
result = tx.executeSql('INSERT INTO globaloptions (k,v) VALUES (?,?)', [key,value])
}
})
}
function deleteConfig(database,userobj,callback) { // delete user data from DB
if (userobj){var where = " WHERE username='"+ userobj.username+"' and server='"+userobj.server+"'";} else { return "no user selected!";}
var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]);
@ -486,6 +513,9 @@ function updateView(viewtype){
//downloadNotice.text="xhr start "+Date.now()
switch(viewtype){
case "Conversations":
// updatenews.setDatabase();
// updatenews.login();
// updatenews.timeline();
var lastnews=Newsjs.getLastNews(login,db);
xhr.setLogin(login.username+":"+Qt.atob(login.password));
xhr.setUrl(login.server);
@ -495,6 +525,9 @@ function updateView(viewtype){
xhr.setParam("count",50)
break;
case "Timeline":
// updatenews.setDatabase();
// updatenews.login();
// updatenews.timeline();
var lastnews=Newsjs.getLastNews(login,db);
xhr.setLogin(login.username+":"+Qt.atob(login.password));
xhr.setUrl(login.server);

View file

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify