Fixes chat encoding problems.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3362 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
parent
5a74cfca89
commit
5eb25de38b
@ -410,11 +410,6 @@ function niceTime(lastTime, thisTime) {
|
|||||||
async function formatMessage(message) {
|
async function formatMessage(message) {
|
||||||
var result;
|
var result;
|
||||||
if (typeof message == "string") {
|
if (typeof message == "string") {
|
||||||
for (let i = message.length - 1; i >= 0; i--) {
|
|
||||||
if (message.charCodeAt(i) >= 128 || message.charCodeAt(i) < 32) {
|
|
||||||
message = message.substring(0, i) + "\\" + message.charCodeAt(i).toString() + message.substring(i + 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
result = [];
|
result = [];
|
||||||
var regex = /(\w+:\/*\S+?)(?=(?:[\.!?])?(?:$|\s))/gi;
|
var regex = /(\w+:\/*\S+?)(?=(?:[\.!?])?(?:$|\s))/gi;
|
||||||
var match;
|
var match;
|
||||||
|
3349
packages/cory/libencoding/libencoding.js
Normal file
3349
packages/cory/libencoding/libencoding.js
Normal file
File diff suppressed because one or more lines are too long
@ -15,7 +15,8 @@
|
|||||||
//! ]
|
//! ]
|
||||||
//! },
|
//! },
|
||||||
//! "require": [
|
//! "require": [
|
||||||
//! "libchat"
|
//! "libchat",
|
||||||
|
//! "libencoding"
|
||||||
//! ]
|
//! ]
|
||||||
//! }
|
//! }
|
||||||
|
|
||||||
@ -683,6 +684,7 @@ XmlStanzaParser.prototype.parseNode = function(node) {
|
|||||||
// end xmpp.js
|
// end xmpp.js
|
||||||
|
|
||||||
let ChatService = require("libchat").ChatService;
|
let ChatService = require("libchat").ChatService;
|
||||||
|
require("libencoding");
|
||||||
|
|
||||||
var gPingCount = 0;
|
var gPingCount = 0;
|
||||||
|
|
||||||
@ -735,10 +737,12 @@ class XmppService {
|
|||||||
self._socket.onError(self._reportError);
|
self._socket.onError(self._reportError);
|
||||||
self._socket.read(function(data) {
|
self._socket.read(function(data) {
|
||||||
try {
|
try {
|
||||||
|
print(data.__prototype__ ? "YEAH!" : "nope");
|
||||||
if (!data) {
|
if (!data) {
|
||||||
self._service.notifyStateChanged("disconnected");
|
self._service.notifyStateChanged("disconnected");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
data = new TextDecoder("UTF-8").decode(new Uint8Array(Object.values(data)));
|
||||||
parse.parse(data).forEach(function(stanza) {
|
parse.parse(data).forEach(function(stanza) {
|
||||||
if (stanza.name == "stream:features") {
|
if (stanza.name == "stream:features") {
|
||||||
if (!started) {
|
if (!started) {
|
||||||
|
Loading…
Reference in New Issue
Block a user