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
121fab13
Commit
121fab13
authored
Mar 05, 2013
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add getVCard method (will be usefull for caching later)
parent
e8e9718b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
24 deletions
+29
-24
converse.js
converse.js
+29
-24
No files found.
converse.js
View file @
121fab13
...
...
@@ -1095,16 +1095,15 @@
if
(
this
.
isChatRoom
(
jid
))
{
this
.
createChatRoom
(
jid
);
}
else
{
xmppchat
.
connection
.
vcard
.
get
(
$
.
proxy
(
function
(
iq
)
{
var
$vcard
=
$
(
iq
).
find
(
'
vCard
'
);
xmppchat
.
getVCard
(
jid
,
$
.
proxy
(
function
(
jid
,
fullname
,
img
,
img_type
,
url
)
{
this
.
createChatBox
({
'
jid
'
:
jid
,
'
fullname
'
:
$vcard
.
find
(
'
FN
'
).
text
()
,
'
image
'
:
$vcard
.
find
(
'
BINVAL
'
).
text
()
,
'
image_type
'
:
$vcard
.
find
(
'
TYPE
'
).
text
()
,
'
url
'
:
$vcard
.
find
(
'
URL
'
).
text
()
,
'
fullname
'
:
fullname
,
'
image
'
:
img
,
'
image_type
'
:
img_type
,
'
url
'
:
url
,
})
},
this
)
,
jid
);
},
this
));
}
}
},
this
));
...
...
@@ -1257,7 +1256,7 @@
});
xmppchat
.
RosterItem
=
Backbone
.
Model
.
extend
({
initialize
:
function
(
jid
,
subscription
,
ask
,
name
,
img
,
img_type
)
{
initialize
:
function
(
jid
,
subscription
,
ask
,
name
,
img
,
img_type
,
url
)
{
var
user_id
=
Strophe
.
getNodeFromJid
(
jid
);
if
(
!
name
)
{
name
=
user_id
;
...
...
@@ -1271,6 +1270,7 @@
'
fullname
'
:
name
,
'
image
'
:
img
,
'
image_type
'
:
img_type
,
'
url
'
:
url
,
'
resources
'
:
[],
'
presence_type
'
:
'
offline
'
,
'
status
'
:
'
offline
'
...
...
@@ -1390,6 +1390,18 @@
}
});
xmppchat
.
getVCard
=
function
(
jid
,
callback
)
{
// TODO: cache vcards
xmppchat
.
connection
.
vcard
.
get
(
$
.
proxy
(
function
(
iq
)
{
$vcard
=
$
(
iq
).
find
(
'
vCard
'
);
var
fullname
=
$vcard
.
find
(
'
FN
'
).
text
(),
img
=
$vcard
.
find
(
'
BINVAL
'
).
text
(),
img_type
=
$vcard
.
find
(
'
TYPE
'
).
text
(),
url
=
$vcard
.
find
(
'
URL
'
).
text
();
callback
(
jid
,
fullname
,
img
,
img_type
,
url
);
},
this
),
jid
)
}
xmppchat
.
RosterItems
=
Backbone
.
Collection
.
extend
({
model
:
xmppchat
.
RosterItem
,
initialize
:
function
()
{
...
...
@@ -1445,8 +1457,8 @@
return
Backbone
.
Collection
.
prototype
.
get
.
call
(
this
,
id
);
},
addRosterItem
:
function
(
jid
,
subscription
,
ask
,
name
,
img
,
img_type
,
options
)
{
var
model
=
new
xmppchat
.
RosterItem
(
jid
,
subscription
,
ask
,
name
,
img
,
img_type
);
addRosterItem
:
function
(
jid
,
subscription
,
ask
,
name
,
img
,
img_type
,
url
,
options
)
{
var
model
=
new
xmppchat
.
RosterItem
(
jid
,
subscription
,
ask
,
name
,
img
,
img_type
,
url
);
model
.
options
=
options
||
{};
this
.
add
(
model
);
},
...
...
@@ -1521,13 +1533,10 @@
if
(
item
===
last_item
)
{
options
.
isLast
=
true
;
}
xmppchat
.
connection
.
vcard
.
get
(
$
.
proxy
(
function
(
iq
)
{
$vcard
=
$
(
iq
).
find
(
'
vCard
'
);
var
fullname
=
$vcard
.
find
(
'
FN
'
).
text
();
var
img
=
$vcard
.
find
(
'
BINVAL
'
).
text
();
var
img_type
=
$vcard
.
find
(
'
TYPE
'
).
text
();
this
.
addRosterItem
(
item
.
jid
,
item
.
subscription
,
item
.
ask
,
fullname
,
img
,
img_type
,
options
);
},
this
),
item
.
jid
)
xmppchat
.
getVCard
(
item
.
jid
,
$
.
proxy
(
function
(
jid
,
fullname
,
img
,
img_type
,
url
)
{
this
.
addRosterItem
(
item
.
jid
,
item
.
subscription
,
item
.
ask
,
fullname
,
img
,
img_type
,
url
,
options
);
},
this
));
}
else
{
// only modify model attributes if they are different from the
// ones that were already set when the rosterItem was added
...
...
@@ -1596,13 +1605,9 @@
if
((
item
)
&&
(
item
.
get
(
'
subscription
'
)
!=
'
none
'
))
{
xmppchat
.
connection
.
roster
.
authorize
(
bare_jid
);
}
else
{
xmppchat
.
connection
.
vcard
.
get
(
$
.
proxy
(
function
(
iq
)
{
$vcard
=
$
(
iq
).
find
(
'
vCard
'
);
var
fullname
=
$vcard
.
find
(
'
BINVAL
'
).
text
();
var
img
=
$vcard
.
find
(
'
BINVAL
'
).
text
();
var
img_type
=
$vcard
.
find
(
'
TYPE
'
).
text
();
this
.
addRosterItem
(
bare_jid
,
'
none
'
,
'
request
'
,
fullname
,
img
,
img_type
,
options
);
},
this
),
jid
)
xmppchat
.
getVCard
(
bare_jid
,
$
.
proxy
(
function
(
jid
,
fullname
,
img
,
img_type
,
url
)
{
this
.
addRosterItem
(
bare_jid
,
'
none
'
,
'
request
'
,
fullname
,
img
,
img_type
,
url
,
options
);
},
this
));
}
}
...
...
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