Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
21800055
Commit
21800055
authored
Apr 28, 2016
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add the ability to replay transcripts of chat logs.
parent
09457d84
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
86 additions
and
3 deletions
+86
-3
.gitignore
.gitignore
+2
-0
converse-logs/converse-logs.js
converse-logs/converse-logs.js
+5
-0
spec/transcripts.js
spec/transcripts.js
+76
-0
src/converse-core.js
src/converse-core.js
+2
-2
tests/utils.js
tests/utils.js
+1
-1
No files found.
.gitignore
View file @
21800055
...
...
@@ -11,6 +11,8 @@
analytics.js
.idea
converse-logs/*.html
# Ruby/Sass/Bundler
.bundle
.sass-cache
...
...
converse-logs/converse-logs.js
0 → 100644
View file @
21800055
define
(
"
transcripts
"
,
[
"
tpl!converse-logs/conversejs.containers-1460718487729
"
,
],
function
()
{
return
arguments
;
});
spec/transcripts.js
0 → 100644
View file @
21800055
/*global converse */
(
function
(
root
,
factory
)
{
define
([
"
jquery
"
,
"
underscore
"
,
"
mock
"
,
"
test_utils
"
,
"
utils
"
,
"
transcripts
"
],
factory
);
}
(
this
,
function
(
$
,
_
,
mock
,
test_utils
,
utils
,
transcripts
)
{
var
Strophe
=
converse_api
.
env
.
Strophe
;
var
IGNORED_TAGS
=
[
'
stream:features
'
,
'
auth
'
,
'
challenge
'
,
'
success
'
,
'
stream:features
'
,
'
response
'
];
function
traverseElement
(
el
,
_stanza
)
{
if
(
typeof
_stanza
!==
'
undefined
'
)
{
if
(
el
.
nodeType
===
3
)
{
_stanza
.
t
(
el
.
nodeValue
);
return
_stanza
;
}
else
{
_stanza
=
_stanza
.
c
(
el
.
nodeName
.
toLowerCase
(),
getAttributes
(
el
));
}
}
else
{
_stanza
=
new
Strophe
.
Builder
(
el
.
nodeName
.
toLowerCase
(),
getAttributes
(
el
)
);
}
_
.
each
(
el
.
childNodes
,
_
.
partial
(
traverseElement
,
_
,
_stanza
));
return
_stanza
.
up
();
}
function
getAttributes
(
el
)
{
var
attributes
=
{};
_
.
each
(
el
.
attributes
,
function
(
att
)
{
attributes
[
att
.
nodeName
]
=
att
.
nodeValue
;
});
return
attributes
;
}
return
describe
(
"
Transcripts of chat logs
"
,
function
()
{
beforeEach
(
function
()
{
test_utils
.
openChatRoom
(
"
discuss
"
,
'
conference.conversejs.org
'
,
'
jc
'
);
test_utils
.
openChatRoom
(
"
dummy
"
,
'
rooms.localhost
'
,
'
jc
'
);
test_utils
.
openChatRoom
(
"
prosody
"
,
'
conference.prosody.im
'
,
'
jc
'
);
});
it
(
"
can be used to replay conversations
"
,
function
()
{
spyOn
(
converse
,
'
areDesktopNotificationsEnabled
'
).
andReturn
(
true
);
_
.
each
(
transcripts
,
function
(
transcript
)
{
var
text
=
transcript
();
var
xml
=
Strophe
.
xmlHtmlNode
(
text
);
$
(
xml
).
children
(
'
log
'
).
children
(
'
body
'
).
each
(
function
(
i
,
el
)
{
$
(
el
).
children
().
each
(
function
(
i
,
el
)
{
if
(
el
.
nodeType
===
3
)
{
return
;
// Ignore text
}
if
(
_
.
contains
(
IGNORED_TAGS
,
el
.
nodeName
.
toLowerCase
()))
{
return
;
}
var
_stanza
=
traverseElement
(
el
);
converse
.
connection
.
_dataRecv
(
test_utils
.
createRequest
(
_stanza
));
});
});
});
});
});
}));
src/converse-core.js
View file @
21800055
...
...
@@ -1567,8 +1567,8 @@
this
.
setUpXMLLogging
=
function
()
{
if
(
this
.
debug
)
{
this
.
connection
.
xmlInput
=
function
(
body
)
{
converse
.
log
(
body
);
};
this
.
connection
.
xmlOutput
=
function
(
body
)
{
converse
.
log
(
body
);
};
this
.
connection
.
xmlInput
=
function
(
body
)
{
converse
.
log
(
body
.
outerHTML
);
};
this
.
connection
.
xmlOutput
=
function
(
body
)
{
converse
.
log
(
body
.
outerHTML
);
};
}
};
...
...
tests/utils.js
View file @
21800055
...
...
@@ -13,7 +13,7 @@
utils
.
createRequest
=
function
(
iq
)
{
iq
=
typeof
iq
.
tree
==
"
function
"
?
iq
.
tree
()
:
iq
;
var
req
=
new
Strophe
.
Request
(
iq
,
function
()
{});
req
.
getResponse
=
function
()
{
req
.
getResponse
=
function
()
{
var
env
=
new
Strophe
.
Builder
(
'
env
'
,
{
type
:
'
mock
'
}).
tree
();
env
.
appendChild
(
iq
);
return
env
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment