mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-02-01 03:12:42 +01:00
Merge branch 'feature/append-chat-api' of github.com:derosm2/etherpad-lite into append-chat-api
This commit is contained in:
commit
c705a058fb
3 changed files with 78 additions and 0 deletions
|
@ -494,6 +494,33 @@ exports.getChatHistory = function(padID, start, end, callback)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
appendChatMessage(padID, text, userID, time), creates a chat message for the pad id
|
||||||
|
|
||||||
|
Example returns:
|
||||||
|
|
||||||
|
{code: 0, message:"ok", data: null
|
||||||
|
{code: 1, message:"padID does not exist", data: null}
|
||||||
|
*/
|
||||||
|
exports.appendChatMessage = function(padID, text, userID, time, callback)
|
||||||
|
{
|
||||||
|
//text is required
|
||||||
|
if(typeof text != "string")
|
||||||
|
{
|
||||||
|
callback(new customError("text is no string","apierror"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//get the pad
|
||||||
|
getPadSafe(padID, true, function(err, pad)
|
||||||
|
{
|
||||||
|
if(ERR(err, callback)) return;
|
||||||
|
|
||||||
|
pad.appendChatMessage(text, userID, parseInt(time));
|
||||||
|
callback();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/*****************/
|
/*****************/
|
||||||
/**PAD FUNCTIONS */
|
/**PAD FUNCTIONS */
|
||||||
/*****************/
|
/*****************/
|
||||||
|
|
|
@ -394,6 +394,53 @@ var version =
|
||||||
, "getChatHead" : ["padID"]
|
, "getChatHead" : ["padID"]
|
||||||
, "restoreRevision" : ["padID", "rev"]
|
, "restoreRevision" : ["padID", "rev"]
|
||||||
}
|
}
|
||||||
|
, "1.2.12":
|
||||||
|
{ "createGroup" : []
|
||||||
|
, "createGroupIfNotExistsFor" : ["groupMapper"]
|
||||||
|
, "deleteGroup" : ["groupID"]
|
||||||
|
, "listPads" : ["groupID"]
|
||||||
|
, "listAllPads" : []
|
||||||
|
, "createDiffHTML" : ["padID", "startRev", "endRev"]
|
||||||
|
, "createPad" : ["padID", "text"]
|
||||||
|
, "createGroupPad" : ["groupID", "padName", "text"]
|
||||||
|
, "createAuthor" : ["name"]
|
||||||
|
, "createAuthorIfNotExistsFor": ["authorMapper" , "name"]
|
||||||
|
, "listPadsOfAuthor" : ["authorID"]
|
||||||
|
, "createSession" : ["groupID", "authorID", "validUntil"]
|
||||||
|
, "deleteSession" : ["sessionID"]
|
||||||
|
, "getSessionInfo" : ["sessionID"]
|
||||||
|
, "listSessionsOfGroup" : ["groupID"]
|
||||||
|
, "listSessionsOfAuthor" : ["authorID"]
|
||||||
|
, "getText" : ["padID", "rev"]
|
||||||
|
, "setText" : ["padID", "text"]
|
||||||
|
, "getHTML" : ["padID", "rev"]
|
||||||
|
, "setHTML" : ["padID", "html"]
|
||||||
|
, "getAttributePool" : ["padID"]
|
||||||
|
, "getRevisionsCount" : ["padID"]
|
||||||
|
, "getRevisionChangeset" : ["padID", "rev"]
|
||||||
|
, "getLastEdited" : ["padID"]
|
||||||
|
, "deletePad" : ["padID"]
|
||||||
|
, "copyPad" : ["sourceID", "destinationID", "force"]
|
||||||
|
, "movePad" : ["sourceID", "destinationID", "force"]
|
||||||
|
, "getReadOnlyID" : ["padID"]
|
||||||
|
, "getPadID" : ["roID"]
|
||||||
|
, "setPublicStatus" : ["padID", "publicStatus"]
|
||||||
|
, "getPublicStatus" : ["padID"]
|
||||||
|
, "setPassword" : ["padID", "password"]
|
||||||
|
, "isPasswordProtected" : ["padID"]
|
||||||
|
, "listAuthorsOfPad" : ["padID"]
|
||||||
|
, "padUsersCount" : ["padID"]
|
||||||
|
, "getAuthorName" : ["authorID"]
|
||||||
|
, "padUsers" : ["padID"]
|
||||||
|
, "sendClientsMessage" : ["padID", "msg"]
|
||||||
|
, "listAllGroups" : []
|
||||||
|
, "checkToken" : []
|
||||||
|
, "getChatHistory" : ["padID"]
|
||||||
|
, "getChatHistory" : ["padID", "start", "end"]
|
||||||
|
, "getChatHead" : ["padID"]
|
||||||
|
, "appendChatMessage" : ["padID", "text", "userID", "time"]
|
||||||
|
, "restoreRevision" : ["padID", "rev"]
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// set the latest available API version here
|
// set the latest available API version here
|
||||||
|
|
|
@ -284,6 +284,10 @@ var API = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"response": {"chatHead":{"type":"Message"}}
|
"response": {"chatHead":{"type":"Message"}}
|
||||||
|
},
|
||||||
|
"appendChatMessage": {
|
||||||
|
"func": "appendChatMessage",
|
||||||
|
"description": "appends a chat message"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue