mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-03 06:35:08 -04:00
Change to Almman indent style
This commit is contained in:
parent
4b05555a5c
commit
9f26a0aec5
6 changed files with 98 additions and 61 deletions
|
@ -5,7 +5,8 @@ import QtQuick.Controls 2.0
|
|||
import org.retroshare.qml_components.LibresapiLocalClient 1.0
|
||||
import Qt.labs.settings 1.0
|
||||
|
||||
QtObject {
|
||||
QtObject
|
||||
{
|
||||
|
||||
id: chatCache
|
||||
|
||||
|
@ -17,7 +18,8 @@ QtObject {
|
|||
signal lastMessageChanged(var chatI, var newLastMessage)
|
||||
|
||||
|
||||
function updateLastMessageCache (chatId, chatModel){
|
||||
function updateLastMessageCache (chatId, chatModel)
|
||||
{
|
||||
console.log("updateLastMessageCache (chatId, chatModel)", chatId)
|
||||
// First creates the chat id object for don't wait to work with the object if is needed to call RS api
|
||||
if (!lastMessageList[chatId]) {
|
||||
|
@ -33,24 +35,28 @@ QtObject {
|
|||
}
|
||||
}
|
||||
|
||||
function updateLastMessage (chatId, chatModel){
|
||||
function updateLastMessage (chatId, chatModel)
|
||||
{
|
||||
console.log("updateLastMessage (chatId, chatModel)")
|
||||
var lastMessage = findChatLastMessage (chatModel)
|
||||
lastMessageList[chatId].lastMessage = lastMessage
|
||||
lastMessageChanged(chatId, lastMessage)
|
||||
}
|
||||
|
||||
function findChatLastMessage (chatModel){
|
||||
function findChatLastMessage (chatModel)
|
||||
{
|
||||
var messagesData = JSON.parse(chatModel).data
|
||||
return messagesData.slice(-1)[0]
|
||||
}
|
||||
|
||||
function findChatFirstMessage (chatModel){
|
||||
function findChatFirstMessage (chatModel)
|
||||
{
|
||||
var messagesData = JSON.parse(chatModel).data
|
||||
return messagesData.slice[0]
|
||||
}
|
||||
|
||||
function setRemoteGXS (chatId, remoteGXS){
|
||||
function setRemoteGXS (chatId, remoteGXS)
|
||||
{
|
||||
if (!lastMessageList[chatId]) {
|
||||
lastMessageList[chatId] = {}
|
||||
console.log("Last message cache created!")
|
||||
|
@ -64,7 +70,8 @@ QtObject {
|
|||
}
|
||||
}
|
||||
|
||||
function getChatIdFromGxs (gxs){
|
||||
function getChatIdFromGxs (gxs)
|
||||
{
|
||||
for (var key in lastMessageList) {
|
||||
if ( lastMessageList[key].remoteGXS &&
|
||||
lastMessageList[key].remoteGXS.gxs === gxs ) {
|
||||
|
@ -74,12 +81,14 @@ QtObject {
|
|||
return ""
|
||||
}
|
||||
|
||||
function getGxsFromChatId (chatId){
|
||||
function getGxsFromChatId (chatId)
|
||||
{
|
||||
if (lastMessageList[chatId]) return lastMessageList[chatId].remoteGXS
|
||||
return undefined
|
||||
}
|
||||
|
||||
function getChatLastMessage (chatId){
|
||||
function getChatLastMessage (chatId)
|
||||
{
|
||||
if (lastMessageList[chatId]) {
|
||||
return lastMessageList[chatId].lastMessage
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue