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
5ab16931
Commit
5ab16931
authored
Jul 05, 2017
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
logging: Add deprecation warning for `updateSettings`
and also use the Strophe.LogLevel levels for logging in general.
parent
f81a94ba
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
66 additions
and
34 deletions
+66
-34
spec/chatbox.js
spec/chatbox.js
+3
-2
src/converse-bookmarks.js
src/converse-bookmarks.js
+2
-2
src/converse-chatview.js
src/converse-chatview.js
+1
-1
src/converse-core.js
src/converse-core.js
+30
-14
src/converse-mam.js
src/converse-mam.js
+12
-6
src/converse-muc.js
src/converse-muc.js
+3
-1
src/converse-notification.js
src/converse-notification.js
+1
-1
src/converse-otr.js
src/converse-otr.js
+1
-1
src/converse-register.js
src/converse-register.js
+6
-3
src/converse-rosterview.js
src/converse-rosterview.js
+1
-1
src/converse-vcard.js
src/converse-vcard.js
+6
-2
No files found.
spec/chatbox.js
View file @
5ab16931
...
...
@@ -775,7 +775,8 @@
_converse
.
chatboxes
.
onMessage
(
msg
);
expect
(
_converse
.
log
).
toHaveBeenCalledWith
(
"
onMessage: Ignoring incoming message intended for a different resource: dummy@localhost/some-other-resource
"
,
"
info
"
);
"
onMessage: Ignoring incoming message intended for a different resource: dummy@localhost/some-other-resource
"
,
Strophe
.
LogLevel
.
INFO
);
expect
(
_converse
.
chatboxes
.
getChatBox
).
not
.
toHaveBeenCalled
();
_converse
.
filter_by_resource
=
false
;
...
...
@@ -819,7 +820,7 @@
_converse
.
chatboxes
.
onMessage
(
msg
);
expect
(
_converse
.
log
.
calledWith
(
"
onMessage: Ignoring incoming headline message sent with type 'chat' from JID: localhost
"
,
"
info
"
Strophe
.
LogLevel
.
INFO
)).
toBeTruthy
();
expect
(
utils
.
isHeadlineMessage
.
called
).
toBeTruthy
();
expect
(
utils
.
isHeadlineMessage
.
returned
(
true
)).
toBeTruthy
();
...
...
src/converse-bookmarks.js
View file @
5ab16931
...
...
@@ -289,7 +289,7 @@
},
onBookmarkError
:
function
(
iq
)
{
_converse
.
log
(
"
Error while trying to add bookmark
"
,
"
error
"
);
_converse
.
log
(
"
Error while trying to add bookmark
"
,
Strophe
.
LogLevel
.
ERROR
);
_converse
.
log
(
iq
);
// We remove all locally cached bookmarks and fetch them
// again from the server.
...
...
@@ -345,7 +345,7 @@
onBookmarksReceivedError
:
function
(
deferred
,
iq
)
{
window
.
sessionStorage
.
setItem
(
this
.
cached_flag
,
true
);
_converse
.
log
(
'
Error while fetching bookmarks
'
);
_converse
.
log
(
'
Error while fetching bookmarks
'
,
Strophe
.
LogLevel
.
ERROR
);
_converse
.
log
(
iq
);
if
(
!
_
.
isNil
(
deferred
))
{
return
deferred
.
reject
();
...
...
src/converse-chatview.js
View file @
5ab16931
...
...
@@ -705,7 +705,7 @@
try
{
this
.
model
.
destroy
();
}
catch
(
e
)
{
_converse
.
log
(
e
);
_converse
.
log
(
e
,
Strophe
.
LogLevel
.
ERROR
);
}
this
.
remove
();
_converse
.
emit
(
'
chatBoxClosed
'
,
this
);
...
...
src/converse-core.js
View file @
5ab16931
...
...
@@ -144,16 +144,21 @@
}
else
{
logger
=
console
;
}
if
(
_converse
.
debug
)
{
if
(
level
===
'
error
'
)
{
logger
.
log
(
'
ERROR:
'
+
txt
);
}
else
{
logger
.
log
(
txt
);
if
(
level
===
Strophe
.
LogLevel
.
ERROR
)
{
logger
.
log
(
'
ERROR:
'
+
txt
);
}
else
if
(
level
===
Strophe
.
LogLevel
.
WARN
)
{
logger
.
log
(
'
WARNING:
'
+
txt
);
}
else
if
(
level
===
Strophe
.
LogLevel
.
FATAL
)
{
logger
.
log
(
'
FATAL:
'
+
txt
);
}
else
if
(
_converse
.
debug
)
{
if
(
level
===
Strophe
.
LogLevel
.
DEBUG
)
{
logger
.
log
(
'
DEBUG:
'
+
txt
);
}
else
if
(
level
===
Strophe
.
LogLevel
.
INFO
)
{
logger
.
log
(
'
INFO:
'
+
txt
);
}
}
};
_converse
.
initialize
=
function
(
settings
,
callback
)
{
"
use strict
"
;
settings
=
!
_
.
isUndefined
(
settings
)
?
settings
:
{};
...
...
@@ -184,7 +189,7 @@
// Logging
Strophe
.
log
=
function
(
level
,
msg
)
{
_converse
.
log
(
level
+
'
'
+
msg
,
level
);
};
Strophe
.
error
=
function
(
msg
)
{
_converse
.
log
(
msg
,
'
error
'
);
};
Strophe
.
error
=
function
(
msg
)
{
_converse
.
log
(
msg
,
Strophe
.
LogLevel
.
ERROR
);
};
// Add Strophe Namespaces
Strophe
.
addNamespace
(
'
CARBONS
'
,
'
urn:xmpp:carbons:2
'
);
...
...
@@ -657,7 +662,9 @@
.
c
(
'
enable
'
,
{
xmlns
:
Strophe
.
NS
.
CARBONS
});
this
.
connection
.
addHandler
(
function
(
iq
)
{
if
(
iq
.
querySelectorAll
(
'
error
'
).
length
>
0
)
{
_converse
.
log
(
'
ERROR: An error occured while trying to enable message carbons.
'
);
_converse
.
log
(
'
An error occured while trying to enable message carbons.
'
,
Strophe
.
LogLevel
.
ERROR
);
}
else
{
this
.
session
.
save
({
carbons_enabled
:
true
});
_converse
.
log
(
'
Message carbons have been enabled.
'
);
...
...
@@ -1133,7 +1140,7 @@
}.
bind
(
this
),
function
(
err
)
{
alert
(
__
(
"
Sorry, there was an error while trying to add
"
+
name
+
"
as a contact.
"
));
_converse
.
log
(
err
);
_converse
.
log
(
err
,
Strophe
.
LogLevel
.
ERROR
);
deferred
.
resolve
(
err
);
}
);
...
...
@@ -1583,7 +1590,7 @@
if
(
_converse
.
filter_by_resource
&&
(
to_resource
&&
to_resource
!==
_converse
.
resource
))
{
_converse
.
log
(
'
onMessage: Ignoring incoming message intended for a different resource:
'
+
to_jid
,
'
info
'
Strophe
.
LogLevel
.
INFO
);
return
true
;
}
else
if
(
utils
.
isHeadlineMessage
(
message
))
{
...
...
@@ -1592,7 +1599,7 @@
// wrong type ('chat'), so we need to filter them out here.
_converse
.
log
(
"
onMessage: Ignoring incoming headline message sent with type 'chat' from JID:
"
+
from_jid
,
'
info
'
Strophe
.
LogLevel
.
INFO
);
return
true
;
}
...
...
@@ -1658,7 +1665,8 @@
};
}
else
if
(
!
_converse
.
allow_non_roster_messaging
)
{
_converse
.
log
(
'
Could not get roster item for JID
'
+
bare_jid
+
'
and allow_non_roster_messaging is set to false
'
,
'
error
'
);
'
and allow_non_roster_messaging is set to false
'
,
Strophe
.
LogLevel
.
ERROR
);
return
;
}
return
this
.
create
(
_
.
assignIn
({
...
...
@@ -2166,7 +2174,15 @@
_converse
.
whitelisted_plugins
);
_converse
.
pluggable
.
initializePlugins
({
'
updateSettings
'
:
_converse
.
api
.
settings
.
update
,
'
updateSettings
'
:
function
()
{
_converse
.
log
(
"
(DEPRECATION)
"
+
"
The `updateSettings` method has been deprecated.
"
+
"
Please use `_converse.api.settings.update` instead.
"
,
Strophe
.
LogLevel
.
WARN
)
_converse
.
api
.
settings
.
update
.
apply
(
_converse
,
arguments
);
},
'
_converse
'
:
_converse
},
whitelist
,
_converse
.
blacklisted_plugins
);
_converse
.
emit
(
'
pluginsInitialized
'
);
...
...
@@ -2298,7 +2314,7 @@
'
open
'
:
function
(
jids
,
attrs
)
{
var
chatbox
;
if
(
_
.
isUndefined
(
jids
))
{
_converse
.
log
(
"
chats.open: You need to provide at least one JID
"
,
"
error
"
);
_converse
.
log
(
"
chats.open: You need to provide at least one JID
"
,
Strophe
.
LogLevel
.
ERROR
);
return
null
;
}
else
if
(
_
.
isString
(
jids
))
{
chatbox
=
_converse
.
getViewForChatBox
(
...
...
src/converse-mam.js
View file @
5ab16931
...
...
@@ -90,7 +90,8 @@
if
(
!
_converse
.
features
.
findWhere
({
'
var
'
:
Strophe
.
NS
.
MAM
}))
{
_converse
.
log
(
"
Attempted to fetch archived messages but this
"
+
"
user's server doesn't support XEP-0313
"
);
"
user's server doesn't support XEP-0313
"
,
Strophe
.
LogLevel
.
WARN
);
return
;
}
if
(
this
.
disable_mam
)
{
...
...
@@ -107,7 +108,7 @@
this
.
clearSpinner
();
_converse
.
log
(
"
Error or timeout while trying to fetch
"
+
"
archived messages
"
,
"
error
"
);
"
archived messages
"
,
Strophe
.
LogLevel
.
ERROR
);
}.
bind
(
this
)
);
},
...
...
@@ -171,7 +172,8 @@
if
(
!
_converse
.
features
.
findWhere
({
'
var
'
:
Strophe
.
NS
.
MAM
}))
{
_converse
.
log
(
"
Attempted to fetch archived messages but this
"
+
"
user's server doesn't support XEP-0313
"
);
"
user's server doesn't support XEP-0313
"
,
Strophe
.
LogLevel
.
WARN
);
return
;
}
if
(
!
this
.
model
.
get
(
'
mam_enabled
'
))
{
...
...
@@ -191,7 +193,7 @@
that
.
clearSpinner
();
_converse
.
log
(
"
Error while trying to fetch archived messages
"
,
"
error
"
);
Strophe
.
LogLevel
.
WARN
);
}
);
}
...
...
@@ -308,9 +310,13 @@
_converse
.
onMAMError
=
function
(
iq
)
{
if
(
$
(
iq
).
find
(
'
feature-not-implemented
'
).
length
)
{
_converse
.
log
(
"
Message Archive Management (XEP-0313) not supported by this browser
"
);
_converse
.
log
(
"
Message Archive Management (XEP-0313) not supported by this server
"
,
Strophe
.
LogLevel
.
WARN
);
}
else
{
_converse
.
log
(
"
An error occured while trying to set archiving preferences.
"
);
_converse
.
log
(
"
An error occured while trying to set archiving preferences.
"
,
Strophe
.
LogLevel
.
ERROR
);
_converse
.
log
(
iq
);
}
};
...
...
src/converse-muc.js
View file @
5ab16931
...
...
@@ -2689,7 +2689,9 @@
}
else
if
(
_
.
isObject
(
room
))
{
_converse
.
api
.
rooms
.
open
(
room
.
jid
,
room
.
nick
);
}
else
{
_converse
.
log
(
'
Invalid room criteria specified for "auto_join_rooms"
'
,
'
error
'
);
_converse
.
log
(
'
Invalid room criteria specified for "auto_join_rooms"
'
,
Strophe
.
LogLevel
.
ERROR
);
}
});
};
...
...
src/converse-notification.js
View file @
5ab16931
...
...
@@ -148,7 +148,7 @@
if
(
_
.
isUndefined
(
_converse
.
roster
))
{
_converse
.
log
(
"
Could not send notification, because roster is undefined
"
,
"
error
"
);
Strophe
.
LogLevel
.
ERROR
);
return
;
}
roster_item
=
_converse
.
roster
.
get
(
from_jid
);
...
...
src/converse-otr.js
View file @
5ab16931
...
...
@@ -351,7 +351,7 @@
}
else
{
this
.
showHelpMessages
([
'
Encryption error occured:
'
+
msg
],
'
error
'
);
}
_converse
.
log
(
"
OTR ERROR:
"
+
msg
);
_converse
.
log
(
"
OTR ERROR:
"
+
msg
,
Strophe
.
LogLevel
.
ERROR
);
},
startOTRFromToolbar
:
function
(
ev
)
{
...
...
src/converse-register.js
View file @
5ab16931
...
...
@@ -304,7 +304,10 @@
Strophe
.
Status
.
CONFLICT
],
status
))
{
_converse
.
log
(
'
Problem during registration: Strophe.Status is:
'
+
status
);
_converse
.
log
(
'
Problem during registration: Strophe.Status is:
'
+
status
,
Strophe
.
LogLevel
.
ERROR
);
this
.
cancelRegistration
();
if
(
error
)
{
this
.
giveFeedback
(
error
,
'
error
'
);
...
...
@@ -534,7 +537,7 @@
this
.
fields
[
_var
.
toLowerCase
()]
=
$
(
field
).
children
(
'
value
'
).
text
();
}
else
{
// TODO: other option seems to be type="fixed"
_converse
.
log
(
"
WARNING: Found field we couldn't parse
"
);
_converse
.
log
(
"
Found field we couldn't parse
"
,
Strophe
.
LogLevel
.
WARN
);
}
}.
bind
(
this
));
this
.
form_type
=
'
xform
'
;
...
...
@@ -554,7 +557,7 @@
query
=
query
[
0
];
}
if
(
stanza
.
getAttribute
(
"
type
"
)
===
"
error
"
)
{
_converse
.
log
(
"
Registration failed.
"
);
_converse
.
log
(
"
Registration failed.
"
,
Strophe
.
LogLevel
.
ERROR
);
error
=
stanza
.
getElementsByTagName
(
"
error
"
);
if
(
error
.
length
!==
1
)
{
_converse
.
connection
.
_changeConnectStatus
(
Strophe
.
Status
.
REGIFAIL
,
"
unknown
"
);
...
...
src/converse-rosterview.js
View file @
5ab16931
...
...
@@ -671,7 +671,7 @@
}.
bind
(
this
),
function
(
err
)
{
alert
(
__
(
"
Sorry, there was an error while trying to remove
"
+
name
+
"
as a contact.
"
));
_converse
.
log
(
err
);
_converse
.
log
(
err
,
Strophe
.
LogLevel
.
ERROR
);
}
);
}
...
...
src/converse-vcard.js
View file @
5ab16931
...
...
@@ -42,7 +42,10 @@
bare_jid
,
_
.
partial
(
_converse
.
createRequestingContactFromVCard
,
presence
),
function
(
iq
,
jid
)
{
_converse
.
log
(
"
Error while retrieving vcard for
"
+
jid
);
_converse
.
log
(
"
Error while retrieving vcard for
"
+
jid
,
Strophe
.
LogLevel
.
ERROR
);
_converse
.
createRequestingContactFromVCard
(
presence
,
iq
,
jid
);
}
);
...
...
@@ -148,7 +151,8 @@
},
function
()
{
_converse
.
log
(
"
updateVCardForChatBox: Error occured while fetching vcard
"
"
updateVCardForChatBox: Error occured while fetching vcard
"
,
Strophe
.
LogLevel
.
ERROR
);
}
);
...
...
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