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
51d0f7d8
Commit
51d0f7d8
authored
Sep 29, 2013
by
Boris Kocherov
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://github.com/jcbrand/converse.js
parents
155b8e6a
e4a1ccf1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
70 additions
and
43 deletions
+70
-43
converse.js
converse.js
+70
-43
No files found.
converse.js
View file @
51d0f7d8
...
@@ -48,6 +48,9 @@
...
@@ -48,6 +48,9 @@
var
UNVERIFIED
=
1
;
var
UNVERIFIED
=
1
;
var
VERIFIED
=
2
;
var
VERIFIED
=
2
;
var
FINISHED
=
3
;
var
FINISHED
=
3
;
var
KEY
=
{
ENTER
:
13
};
// Default values
// Default values
var
converse
=
this
;
var
converse
=
this
;
...
@@ -785,7 +788,7 @@
...
@@ -785,7 +788,7 @@
keyPressed
:
function
(
ev
)
{
keyPressed
:
function
(
ev
)
{
var
$textarea
=
$
(
ev
.
target
),
var
$textarea
=
$
(
ev
.
target
),
message
,
notify
,
composing
;
message
,
notify
,
composing
;
if
(
ev
.
keyCode
==
13
)
{
if
(
ev
.
keyCode
==
KEY
.
ENTER
)
{
ev
.
preventDefault
();
ev
.
preventDefault
();
message
=
$textarea
.
val
();
message
=
$textarea
.
val
();
$textarea
.
val
(
''
).
focus
();
$textarea
.
val
(
''
).
focus
();
...
@@ -2242,6 +2245,28 @@
...
@@ -2242,6 +2245,28 @@
var
item
=
this
.
model
,
var
item
=
this
.
model
,
ask
=
item
.
get
(
'
ask
'
),
ask
=
item
.
get
(
'
ask
'
),
subscription
=
item
.
get
(
'
subscription
'
);
subscription
=
item
.
get
(
'
subscription
'
);
var
statuses
=
{
'
dnd
'
:
__
(
'
This contact is busy
'
),
'
online
'
:
__
(
'
This contact is online
'
),
'
offline
'
:
__
(
'
This contact is offline
'
),
'
unavailable
'
:
__
(
'
This contact is unavailable
'
),
'
xa
'
:
__
(
'
This contact is away for an extended period
'
),
'
away
'
:
__
(
'
This contact is away
'
)
}
var
classes_to_remove
=
[
'
current-xmpp-contact
'
,
'
pending-xmpp-contact
'
,
'
requesting-xmpp-contact
'
].
concat
(
_
.
keys
(
statuses
));
_
.
each
(
classes_to_remove
,
function
(
cls
)
{
if
(
this
.
el
.
className
.
indexOf
(
cls
)
!==
-
1
)
{
this
.
$el
.
removeClass
(
cls
);
}
},
this
);
this
.
$el
.
addClass
(
item
.
get
(
'
chat_status
'
));
this
.
$el
.
addClass
(
item
.
get
(
'
chat_status
'
));
if
(
ask
===
'
subscribe
'
)
{
if
(
ask
===
'
subscribe
'
)
{
...
@@ -2252,44 +2277,25 @@
...
@@ -2252,44 +2277,25 @@
this
.
$el
.
html
(
this
.
request_template
(
item
.
toJSON
()));
this
.
$el
.
html
(
this
.
request_template
(
item
.
toJSON
()));
converse
.
showControlBox
();
converse
.
showControlBox
();
}
else
if
(
subscription
===
'
both
'
||
subscription
===
'
to
'
)
{
}
else
if
(
subscription
===
'
both
'
||
subscription
===
'
to
'
)
{
_
.
each
([
'
pending-xmpp-contact
'
,
'
requesting-xmpp-contact
'
],
function
(
cls
)
{
if
(
this
.
el
.
className
.
indexOf
(
cls
)
!==
-
1
)
{
this
.
$el
.
removeClass
(
cls
);
}
},
this
);
this
.
$el
.
addClass
(
'
current-xmpp-contact
'
);
this
.
$el
.
addClass
(
'
current-xmpp-contact
'
);
var
status_desc
=
{
'
dnd
'
:
__
(
'
This contact is busy
'
),
'
online
'
:
__
(
'
This contact is online
'
),
'
offline
'
:
__
(
'
This contact is offline
'
),
'
unavailable
'
:
__
(
'
This contact is unavailable
'
),
'
xa
'
:
__
(
'
This contact is away for an extended period
'
),
'
away
'
:
__
(
'
This contact is away
'
)
}[
item
.
get
(
'
chat_status
'
)
||
'
offline
'
];
this
.
$el
.
html
(
this
.
template
(
this
.
$el
.
html
(
this
.
template
(
_
.
extend
(
item
.
toJSON
(),
{
'
status_desc
'
:
status
_desc
})
_
.
extend
(
item
.
toJSON
(),
{
'
status_desc
'
:
status
es
[
item
.
get
(
'
chat_status
'
)
||
'
offline
'
]
})
));
));
}
}
return
this
;
return
this
;
},
},
initialize
:
function
()
{
this
.
options
.
model
.
on
(
'
change
'
,
function
(
item
,
changed
)
{
if
(
_
.
has
(
item
.
changed
,
'
chat_status
'
))
{
this
.
$el
.
attr
(
'
class
'
,
item
.
changed
.
chat_status
);
}
},
this
);
}
});
});
this
.
getVCard
=
function
(
jid
,
callback
,
errback
)
{
this
.
getVCard
=
function
(
jid
,
callback
,
errback
)
{
converse
.
connection
.
vcard
.
get
(
$
.
proxy
(
function
(
iq
)
{
converse
.
connection
.
vcard
.
get
(
$
.
proxy
(
function
(
iq
)
{
// Successful callback
$vcard
=
$
(
iq
).
find
(
'
vCard
'
);
$vcard
=
$
(
iq
).
find
(
'
vCard
'
);
var
fullname
=
$vcard
.
find
(
'
FN
'
).
text
(),
var
fullname
=
$vcard
.
find
(
'
FN
'
).
text
(),
img
=
$vcard
.
find
(
'
BINVAL
'
).
text
(),
img
=
$vcard
.
find
(
'
BINVAL
'
).
text
(),
img_type
=
$vcard
.
find
(
'
TYPE
'
).
text
(),
img_type
=
$vcard
.
find
(
'
TYPE
'
).
text
(),
url
=
$vcard
.
find
(
'
URL
'
).
text
();
url
=
$vcard
.
find
(
'
URL
'
).
text
();
if
(
jid
)
{
var
rosteritem
=
converse
.
roster
.
get
(
jid
);
var
rosteritem
=
converse
.
roster
.
get
(
jid
);
if
(
rosteritem
)
{
if
(
rosteritem
)
{
rosteritem
.
save
({
rosteritem
.
save
({
...
@@ -2300,8 +2306,24 @@
...
@@ -2300,8 +2306,24 @@
'
vcard_updated
'
:
converse
.
toISOString
(
new
Date
())
'
vcard_updated
'
:
converse
.
toISOString
(
new
Date
())
});
});
}
}
}
if
(
callback
)
{
callback
(
jid
,
fullname
,
img
,
img_type
,
url
);
callback
(
jid
,
fullname
,
img
,
img_type
,
url
);
},
this
),
jid
,
errback
);
}
},
this
),
jid
,
function
(
iq
)
{
// Error callback
var
rosteritem
=
converse
.
roster
.
get
(
jid
);
if
(
rosteritem
)
{
rosteritem
.
save
({
'
vcard_updated
'
:
converse
.
toISOString
(
new
Date
())
});
}
if
(
errback
)
{
errback
(
iq
);
}
});
};
};
this
.
RosterItems
=
Backbone
.
Collection
.
extend
({
this
.
RosterItems
=
Backbone
.
Collection
.
extend
({
...
@@ -2576,6 +2598,11 @@
...
@@ -2576,6 +2598,11 @@
var
view
=
new
converse
.
RosterItemView
({
model
:
item
});
var
view
=
new
converse
.
RosterItemView
({
model
:
item
});
this
.
rosteritemviews
[
item
.
id
]
=
view
;
this
.
rosteritemviews
[
item
.
id
]
=
view
;
this
.
render
(
item
);
this
.
render
(
item
);
if
(
!
item
.
get
(
'
vcard_updated
'
))
{
// This will update the vcard, which triggers a change
// request which will rerender the roster item.
converse
.
getVCard
(
item
.
get
(
'
jid
'
));
}
},
this
);
},
this
);
this
.
model
.
on
(
'
change
'
,
function
(
item
,
changed
)
{
this
.
model
.
on
(
'
change
'
,
function
(
item
,
changed
)
{
...
...
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