forked from lubuwest/Friendiqa
new version with hashtags
This commit is contained in:
parent
d81ad52031
commit
56bdb80ea0
47 changed files with 1424 additions and 825 deletions
|
@ -172,11 +172,11 @@ function deleteContacts(database,user,callback) { // does nothing useful at the
|
|||
// })
|
||||
//}
|
||||
|
||||
function newRequestFriendsAlbumPictures(login,friend,rootwindow,callback){print("newRequestFriendsAlbumPictures");
|
||||
function newRequestFriendsAlbumPictures(login,friend,rootwindow,callback){//print("newRequestFriendsAlbumPictures");
|
||||
// screenscraping of albums page of contact with remoteAuth
|
||||
//commented out for broken remoteauth
|
||||
//Helperjs.friendicaRemoteAuthRequest(login,friend.url.replace("profile","photos"),friend.url,rootwindow,function(photohtml){
|
||||
Helperjs.friendicaWebRequest(friend.url.replace("profile","photos"),rootwindow,function(photohtml){
|
||||
Helperjs.friendicaRemoteAuthRequest(login,friend.url.replace("profile","photos"),friend.url,rootwindow,function(photohtml){
|
||||
//Helperjs.friendicaWebRequest(friend.url.replace("profile","photos"),rootwindow,function(photohtml){
|
||||
try {var obj=JSON.parse(photohtml);print ("Photohtml: "+photohtml)
|
||||
if (obj.hasOwnProperty('status')){
|
||||
Helperjs.friendicaWebRequest(friend.url.replace("profile","photos"),rootwindow,function(photohtml){
|
||||
|
@ -190,7 +190,7 @@ function newRequestFriendsAlbumPictures(login,friend,rootwindow,callback){print(
|
|||
}
|
||||
|
||||
function getAlbumFromHtml(photohtml,remoteAuthBool,rootwindow,callback){
|
||||
print(photohtml);
|
||||
//print(photohtml);
|
||||
var photoarray=[];
|
||||
var arr = photohtml.split("sidebar-photos-albums-li");
|
||||
for (var i=2;i<arr.length;i++){
|
||||
|
|
|
@ -86,6 +86,37 @@ function listFriends(login,database,callback,filter){
|
|||
});
|
||||
}
|
||||
|
||||
function listHashtags(login,database,callback){
|
||||
var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]);
|
||||
db.transaction( function(tx) {
|
||||
var result = tx.executeSql('SELECT * from hashtags WHERE username="'+login.username+'" ORDER BY date DESC LIMIT 50');
|
||||
// check for friends
|
||||
var taglist=[];
|
||||
for (var i=0;i<result.rows.length;i++){
|
||||
var tag=result.rows.item(i).tag;
|
||||
tag=Qt.atob(tag);
|
||||
taglist.push(tag)}
|
||||
callback(taglist)
|
||||
});
|
||||
}
|
||||
|
||||
function storeHashtags(login,database,newstext,rootwindow){
|
||||
var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]);
|
||||
var curDate= Date.now();
|
||||
var hashtags=[];
|
||||
hashtags=findTags(newstext);
|
||||
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
|
||||
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])
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function deleteGroup(login,database,rootwindow,group, callback){
|
||||
var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]);
|
||||
Helperjs.friendicaPostRequest(login,"/api/friendica/group_delete?gid="+group.gid+"&name="+group.groupname,"","POST",rootwindow, function (obj){
|
||||
|
@ -199,67 +230,20 @@ function storeNews(login,database,news,rootwindow){
|
|||
}
|
||||
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}
|
||||
|
||||
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
|
||||
if(result.rows.length === 1) {// use update
|
||||
//print(news[i].id +' news exists, update it'+'UPDATE news SET username="'+login.username+'", messagetype=0, text="'+Qt.btoa(news[i].text)+'", created_at="'+Date.parse(cleanDate(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].status_html)+'", statusnet_conversation_id="'+news[i].statusnet_conversation_id+'",friendica_activities="'+Qt.btoa(JSON.stringify(friendica_activities))+'",attachments="'+attachments+'",friendica_owner="'+news[i].friendica_owner.url+'" where username="'+login.username+'" AND status_id="'+news[i].status_id+'" AND messagetype=0')
|
||||
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].status_html)+'", statusnet_conversation_id="'+news[i].statusnet_conversation_id+'",friendica_activities="'+Qt.btoa(JSON.stringify(friendica_activities))+'",attachments="'+attachments+'",friendica_owner="'+news[i].friendica_author.url+'" where username="'+login.username+'" AND status_id="'+news[i].status_id+'" AND messagetype=0');
|
||||
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].friendica_author.url+'" where username="'+login.username+'" AND status_id="'+news[i].status_id+'" AND messagetype=0');
|
||||
} else {// use insert
|
||||
result = tx.executeSql('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 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)', [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])}})
|
||||
}
|
||||
// getDirectMessage(login,database,rootwindow,callback)
|
||||
}
|
||||
|
||||
//function getDirectMessage(login,database,rootwindow,callback){
|
||||
// var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]);
|
||||
// var parameter = "";
|
||||
// db.transaction( function(tx) {
|
||||
// var result = tx.executeSql('SELECT status_id from news WHERE username="'+login.username+'" AND messagetype=1 ORDER BY status_id DESC LIMIT 1'); // check for last news id
|
||||
// try{parameter="&since_id="+result.rows.item(0).status_id;}catch(e){};})
|
||||
// Helperjs.friendicaRequest(login,"/api/direct_messages/all"+parameter,rootwindow, function (obj){
|
||||
// var messages=JSON.parse(obj);
|
||||
// for (var i=0;i<messages.length;i++){
|
||||
// //print('store message data for '+JSON.stringify(messages[i]));
|
||||
// db.transaction( function(tx) {
|
||||
// var result = tx.executeSql('SELECT * from news where username= "'+login.username+'" AND status_id = "'+messages[i].id+'" AND messagetype=1'); // check for news id
|
||||
// if(result.rows.length === 1) {// use update
|
||||
// print(messages[i].id +' directmessage exists, update it')
|
||||
// result = tx.executeSql('UPDATE news SET username="'+login.username+'", messagetype=1, text="'+Qt.btoa(messages[i].text)+'", created_at="'+Date.parse(cleanDate(messages[i].created_at))+'", source="Friendica", status_id="'+messages[i].id+'", uid="'+messages[i].sender.id+'", statusnet_html="'+Qt.btoa(messages[i].text)+'", statusnet_conversation_id="'+messages[i].friendica_parent_uri+'" where username="'+login.username+'" AND status_id="'+messages[i].status_id+'" AND messagetype=1');
|
||||
// } else {// use insert
|
||||
// result = tx.executeSql('INSERT INTO news (username,messagetype,text,created_at,source,status_id,uid,statusnet_html,statusnet_conversation_id) VALUES (?,?,?,?,?,?,?,?,?)', [login.username,1,Qt.btoa(messages[i].text),Date.parse(cleanDate(messages[i].created_at)), "Friendica", messages[i].id, messages[i].sender.id,Qt.btoa(messages[i].text),messages[i].friendica_parent_uri])}
|
||||
// });
|
||||
// }
|
||||
// })
|
||||
// callback()
|
||||
//// if(login.newsViewType=="Timeline"){newsfromdb(database,login.username,callback)}
|
||||
//// else{chatsfromdb(database,login.username,callback)}
|
||||
//}
|
||||
|
||||
//function getNotifications(login,database,rootwindow,callback){
|
||||
// Helperjs.friendicaRequest(login,"/api/friendica/notifications", rootwindow,function (obj){
|
||||
// var messages=JSON.parse(obj);
|
||||
// var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]);
|
||||
// for (var i=0;i<messages.length;i++){
|
||||
// //print('store message data for '+JSON.stringify(messages[i]));
|
||||
// db.transaction( function(tx) {
|
||||
// var result = tx.executeSql('SELECT * from news where username="'+login.username+'" AND status_id = "'+messages[i].id+'" AND messagetype=2'); // check for news id
|
||||
// if(result.rows.length === 1) {// use update
|
||||
// print(messages[i].id +' Notification exists, update it')
|
||||
// result = tx.executeSql('UPDATE news SET username="'+login.username+'", messagetype=2, text="'+Qt.btoa(messages[i].msg_html)+'", created_at="'+Date.parse(messages[i].date)+'", source="Friendica", status_id="'+messages[i].id+'", uid="'+messages[i].uid+'", statusnet_html="'+Qt.btoa(messages[i].msg_html)+'", statusnet_conversation_id="'+messages[i].parent+'" where username="'+login.username+'" AND status_id="'+messages[i].id+'" AND messagetype=2');
|
||||
// } else {// use insert
|
||||
// result = tx.executeSql('INSERT INTO news (username,messagetype,text,created_at,source,status_id, uid,statusnet_html,statusnet_conversation_id) VALUES (?,?,?,?,?,?,?,?,?)', [login.username,2,Qt.btoa(messages[i].msg_html),Date.parse(messages[i].date),"Friendica", messages[i].id, messages[i].uid,Qt.btoa(messages[i].msg_html),messages[i].parent])}
|
||||
// });
|
||||
// }
|
||||
// db.transaction( function(tx) {
|
||||
// var newsrs=tx.executeSql('select * from news WHERE username="'+login.username+'" AND messagetype=2 ORDER BY status_id DESC LIMIT 20');
|
||||
// var newsArray=[];
|
||||
// for(var j = 0; j < newsrs.rows.length; j++) {
|
||||
// newsArray.push(newsrs.rows.item(j));
|
||||
// newsArray[j].statusnet_html=Qt.atob(newsArray[j].statusnet_html);
|
||||
// callback(newsArray);
|
||||
// }
|
||||
// })
|
||||
//})}
|
||||
|
||||
function getActivitiesUserData(allcontacts,userUrlArray){//print(JSON.stringify(userUrlArray));
|
||||
var helpArray=[];
|
||||
|
@ -341,9 +325,9 @@ function retweetNews(login,database,newsid,rootwindow,callback){
|
|||
})
|
||||
}
|
||||
|
||||
function favorite(login,favorite,newsid,rootwindow){
|
||||
function favorite(login,favorited,newsid,rootwindow){
|
||||
// toggle favorites
|
||||
if(favorite){ Helperjs.friendicaPostRequest(login,"/api/favorites/create?id="+newsid,"","POST", rootwindow,function (obj){
|
||||
if(favorited){ Helperjs.friendicaPostRequest(login,"/api/favorites/create?id="+newsid,"","POST", rootwindow,function (obj){
|
||||
})}
|
||||
else {Helperjs.friendicaPostRequest(login,"/api/favorites/destroy?id="+newsid,"","POST",rootwindow,function (obj){
|
||||
})}
|
||||
|
@ -443,21 +427,6 @@ function requestFavorites(login,database,contacts,rootwindow,callback){
|
|||
callback(news,newContacts)
|
||||
})}
|
||||
|
||||
//function favoritesfromdb(database,user,callback){
|
||||
// var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]);
|
||||
// db.transaction( function(tx) {
|
||||
// //print('select * from news WHERE username="'+user+'" AND favorited=1 ORDER BY status_id DESC');
|
||||
// var newsrs=tx.executeSql('select * from news WHERE username="'+user+'" AND favorited=1 ORDER BY status_id DESC');
|
||||
// var newsArray=[];
|
||||
// var allcontacts=getAllContacts(database,user);
|
||||
// for(var i = 0; i < newsrs.rows.length; i++) {
|
||||
// newsArray.push(newsrs.rows.item(i));
|
||||
// newsArray[i].statusnet_html=Qt.atob(newsArray[i].statusnet_html);
|
||||
// newsArray[i].id=newsArray[i].status_id;
|
||||
// newsArray[i]=fetchUsersForNews(database,user,newsArray[i],allcontacts);
|
||||
// if (newsArray[i].attachments!==null){newsArray[i].attachments=JSON.parse(Qt.atob(newsArray[i].attachments))};
|
||||
// callback(newsArray);
|
||||
// }})}
|
||||
|
||||
function chatsfromdb(database,login,messagetype,callback,stop_time){
|
||||
|
||||
|
@ -598,3 +567,7 @@ function cleanDate(date){
|
|||
var cleanedDate= date.slice(0,3)+", "+date.slice(8,11)+date.slice(4,7)+date.slice(25,30)+date.slice(10,25);
|
||||
return cleanedDate
|
||||
}
|
||||
|
||||
function findTags(fulltext){
|
||||
return fulltext.match(/\s+[#]+[A-Za-z0-9-_\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]+/g)
|
||||
}
|
||||
|
|
|
@ -144,6 +144,7 @@ else{
|
|||
|
||||
if (newsitemobject.hasOwnProperty("currentconversation")&&(newsitemobject.currentconversation.length>1)){
|
||||
newsitemobject.lastcomment=beautify(newsitemobject.currentconversation[newsitemobject.currentconversation.length-1],msg);
|
||||
newsitemobject.lastcomment.indent=1
|
||||
//print("Currentconversation" + newsitemobject.currentconversation.length+JSON.stringify(newsitemobject.lastcomment))
|
||||
}
|
||||
|
||||
|
|
|
@ -49,8 +49,12 @@ 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)')
|
||||
})}
|
||||
tx.executeSql('CREATE TABLE IF NOT EXISTS globaloptions(k TEXT, v TEXT)');
|
||||
tx.executeSql('CREATE TABLE IF NOT EXISTS friendshiprequests(username TEXT, id INT, usernamef TEXT, acct TEXT, display_name TEXT, locked TEXT, created_at INT, followers_count INT, following_count INT, statuses_count INT, note TEXT, url TEXT, avatar TEXT, avatar_static TEXT, header TEXT, header_static TEXT, emojis TEXT, moved TEXT, fields TEXT, bot TEXT, groupf TEXT, discoverable TEXT, last_status_at INT)');
|
||||
tx.executeSql('CREATE TABLE IF NOT EXISTS hashtags(username TEXT, tag TEXT,date INT, statuses TEXT, ownership INT )');
|
||||
tx.executeSql('CREATE TABLE IF NOT EXISTS drafts(username TEXT, header TEXT, statushtml TEXT, attachments TEXT, permissions TEXT, sendtime INT)');
|
||||
|
||||
})}
|
||||
|
||||
function cleanPermissions(oldperms){
|
||||
var newperms=oldperms.replace("<","");newperms=newperms.replace(">","");newperms="["+newperms+"]";
|
||||
|
@ -263,16 +267,9 @@ try {Helperjs.friendicaRequest(login,"/api/statusnet/config",rootwindow, functio
|
|||
"\nFriendica version: "+serverconfig.site.friendica.FRIENDICA_VERSION+"\nDFRN version: "+serverconfig.site.friendica.DFRN_PROTOCOL_VERSION +
|
||||
"\nDB Update version: "+serverconfig.site.friendica.DB_UPDATE_VERSION+"'}";
|
||||
|
||||
var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]);
|
||||
db.transaction( function(tx) {
|
||||
var result = tx.executeSql('UPDATE config SET APIVersion="'+ serverconfig.site.friendica.FRIENDICA_VERSION+'" WHERE username="'+login.username +'"')})
|
||||
|
||||
// Helperjs.friendicaRequest(login,"/friendica/json",rootwindow, function (obj){
|
||||
// var serverData = JSON.parse(obj);var serverAddons=JSON.stringify(serverData.plugins).replace(/"/g,"");
|
||||
// db.transaction( function(tx) {
|
||||
// var result = tx.executeSql('UPDATE config SET addons="'+ serverAddons+'" WHERE username="'+login.username +'"')})
|
||||
|
||||
// })
|
||||
var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]);
|
||||
db.transaction( function(tx) {
|
||||
var result = tx.executeSql('UPDATE config SET APIVersion="'+ serverconfig.site.friendica.FRIENDICA_VERSION+'" WHERE username="'+login.username +'"')})
|
||||
callback(serverconfigString);
|
||||
})}
|
||||
catch (e){callback (e);
|
||||
|
@ -371,8 +368,7 @@ function updateNewsviewtype(database, newsViewtype){
|
|||
function cleanNews(database,callback){
|
||||
var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]);
|
||||
db.transaction( function(tx) {
|
||||
//var maxnewsrs = tx.executeSql("SELECT DISTINCT maxnews FROM config");
|
||||
var maxnewsrs = tx.executeSql("SELECT v FROM globaloptions WHERE k='max_news'");
|
||||
var maxnewsrs = tx.executeSql("SELECT v FROM globaloptions WHERE k='max_news'");
|
||||
var maxnews=1000; if(maxnewsrs.rows.length>0){ maxnews=maxnewsrs.rows.item(0).v};
|
||||
for (var i=0; i<6;i++){
|
||||
if (i!=0){var maxnewsa=maxnews/5}else{maxnewsa=maxnews}
|
||||
|
@ -381,8 +377,6 @@ function cleanNews(database,callback){
|
|||
if (newscountrs.rows.length>0){newscount=newscountrs.rows.item(0)["COUNT(*)"]};//print(i+"newscount "+newscount)
|
||||
if (newscount>maxnewsa){
|
||||
var lastvalidtimers= tx.executeSql('SELECT DISTINCT created_at FROM news WHERE messagetype='+i+' ORDER BY created_at ASC LIMIT ' +(newscount-maxnewsa));
|
||||
// print('SELECT DISTINCT created_at FROM news WHERE messagetype='+i+' ORDER BY created_at ASC LIMIT ' +(newscount-maxnewsa))
|
||||
// print(JSON.stringify(lastvalidtimers.rows.item(newscount-maxnewsa-1)))
|
||||
var lastvalidtime=lastvalidtimers.rows.item(newscount-maxnewsa-1).created_at;
|
||||
var deleters = tx.executeSql('DELETE from news WHERE messagetype='+i+' AND created_at<='+lastvalidtime)}
|
||||
}
|
||||
|
@ -406,6 +400,20 @@ function cleanContacts(login,database,callback){
|
|||
})
|
||||
}
|
||||
|
||||
function cleanHashtags(database,callback){
|
||||
var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]);
|
||||
db.transaction( function(tx) {
|
||||
var tagcountrs = tx.executeSql('SELECT COUNT(*) from hashtags');
|
||||
var tagcount = 0;
|
||||
if (tagcountrs.rows.length>0){tagcount=tagcountrs.rows.item(0)["COUNT(*)"]};
|
||||
if (tagcount>50){
|
||||
var lastvaliddaters= tx.executeSql('SELECT DISTINCT date FROM hashtags ORDER BY date ASC LIMIT ' +(tagcount-50));
|
||||
var lastvaliddate=lastvaliddaters.rows.item(tagcount-49).date;
|
||||
var deleters = tx.executeSql('DELETE from hashtags WHERE date<='+lastvaliddate)}
|
||||
callback()
|
||||
})
|
||||
}
|
||||
|
||||
function updateContactInDB(login,database,isFriend,contact){// for newstab and friendstab
|
||||
var currentTime=Date.now();
|
||||
var image_timestamp=0;
|
||||
|
@ -424,8 +432,6 @@ function updateContactInDB(login,database,isFriend,contact){// for newstab and f
|
|||
}
|
||||
|
||||
function processNews(api,data){
|
||||
//print("processNews "+api + data);
|
||||
|
||||
try{var newslist=JSON.parse(data)} catch(e){newsBusy.running=false;};
|
||||
if (data==""){}
|
||||
else if (typeof(newslist)=='undefined'){
|
||||
|
@ -478,6 +484,9 @@ function processNews(api,data){
|
|||
if (api=="/api/statuses/replies"){newslist[n].messagetype=3}else{newslist[n].messagetype=0;}
|
||||
newslist[n].friendica_author=cleanUser(newslist[n].friendica_author);
|
||||
newslist[n].user=cleanUser(newslist[n].user);
|
||||
if (newslist[n].friendica_title!="") {newslist[n].statusnet_html="<b>"+newslist[n].friendica_title +"</b><br><br>"+newslist[n].friendica_html;}
|
||||
else{newslist[n].statusnet_html=newslist[n].friendica_html}
|
||||
|
||||
if(newslist[n].in_reply_to_user_id){newslist[n].reply_user=Newsjs.objFromArray(allcontacts,"id",newslist[n].in_reply_to_user_id)}
|
||||
if(newslist[n].hasOwnProperty('friendica_activities')){
|
||||
for (var m in newslist[n].friendica_activities.like){
|
||||
|
@ -653,12 +662,9 @@ function showGroups(){
|
|||
|
||||
function setBackgroundsync(){
|
||||
Helperjs.readData(db,"globaloptions","",function(lastsync){
|
||||
//print("Lastsync "+(parseFloat(lastsync[0]["v"])+120) + " Date "+Date.now()/1000 + " "+((parseFloat(lastsync[0]["v"])+120)<(Date.now()/1000)))
|
||||
if((lastsync.length>0)&&((parseFloat(lastsync[0]["v"])+120)<(Date.now()/1000))){
|
||||
alarm.setAlarm(root.globaloptions.syncinterval);
|
||||
|
||||
}
|
||||
|
||||
},"k","lastsync")
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue