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
95a0b91a
Commit
95a0b91a
authored
Aug 19, 2016
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update 'rooms' api to allow user to pass in room attributes.
parent
1ee7d06a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
15 deletions
+24
-15
src/converse-core.js
src/converse-core.js
+3
-3
src/converse-muc.js
src/converse-muc.js
+21
-12
No files found.
src/converse-core.js
View file @
95a0b91a
...
@@ -1396,7 +1396,7 @@
...
@@ -1396,7 +1396,7 @@
return
true
;
return
true
;
},
},
getChatBox
:
function
(
jid
,
create
)
{
getChatBox
:
function
(
jid
,
create
,
attrs
)
{
/* Returns a chat box or optionally return a newly
/* Returns a chat box or optionally return a newly
* created one if one doesn't exist.
* created one if one doesn't exist.
*
*
...
@@ -1413,14 +1413,14 @@
...
@@ -1413,14 +1413,14 @@
converse
.
log
(
'
Could not get roster item for JID
'
+
bare_jid
,
'
error
'
);
converse
.
log
(
'
Could not get roster item for JID
'
+
bare_jid
,
'
error
'
);
return
;
return
;
}
}
chatbox
=
this
.
create
({
chatbox
=
this
.
create
(
_
.
extend
(
{
'
id
'
:
bare_jid
,
'
id
'
:
bare_jid
,
'
jid
'
:
bare_jid
,
'
jid
'
:
bare_jid
,
'
fullname
'
:
_
.
isEmpty
(
roster_item
.
get
(
'
fullname
'
))?
jid
:
roster_item
.
get
(
'
fullname
'
),
'
fullname
'
:
_
.
isEmpty
(
roster_item
.
get
(
'
fullname
'
))?
jid
:
roster_item
.
get
(
'
fullname
'
),
'
image_type
'
:
roster_item
.
get
(
'
image_type
'
),
'
image_type
'
:
roster_item
.
get
(
'
image_type
'
),
'
image
'
:
roster_item
.
get
(
'
image
'
),
'
image
'
:
roster_item
.
get
(
'
image
'
),
'
url
'
:
roster_item
.
get
(
'
url
'
)
'
url
'
:
roster_item
.
get
(
'
url
'
)
});
}
,
attrs
||
{})
);
}
}
return
chatbox
;
return
chatbox
;
}
}
...
...
src/converse-muc.js
View file @
95a0b91a
...
@@ -1602,16 +1602,15 @@
...
@@ -1602,16 +1602,15 @@
}
}
/* ------------------------------------------------------------ */
/* ------------------------------------------------------------ */
var
_transform
=
function
(
jid
,
nick
,
fetcher
)
{
var
_transform
=
function
(
jid
,
attrs
,
fetcher
)
{
jid
=
jid
.
toLowerCase
();
jid
=
jid
.
toLowerCase
();
return
converse
.
wrappedChatBox
(
fetcher
({
return
converse
.
wrappedChatBox
(
fetcher
(
_
.
extend
(
{
'
id
'
:
jid
,
'
id
'
:
jid
,
'
jid
'
:
jid
,
'
jid
'
:
jid
,
'
name
'
:
Strophe
.
unescapeNode
(
Strophe
.
getNodeFromJid
(
jid
)),
'
name
'
:
Strophe
.
unescapeNode
(
Strophe
.
getNodeFromJid
(
jid
)),
'
nick
'
:
nick
,
'
type
'
:
'
chatroom
'
,
'
type
'
:
'
chatroom
'
,
'
box_id
'
:
b64_sha1
(
jid
)
'
box_id
'
:
b64_sha1
(
jid
)
}));
}
,
attrs
)
));
};
};
...
@@ -1637,16 +1636,26 @@
...
@@ -1637,16 +1636,26 @@
});
});
}
}
},
},
'
open
'
:
function
(
jids
,
nick
)
{
'
open
'
:
function
(
jids
,
attrs
)
{
if
(
typeof
attrs
===
"
string
"
)
{
attrs
=
{
'
nick
'
:
attrs
};
}
else
if
(
typeof
attrs
===
"
undefined
"
)
{
attrs
=
{};
}
var
fetcher
=
converse
.
chatboxviews
.
showChat
.
bind
(
converse
.
chatboxviews
);
var
fetcher
=
converse
.
chatboxviews
.
showChat
.
bind
(
converse
.
chatboxviews
);
if
(
typeof
jids
===
"
undefined
"
)
{
if
(
typeof
jids
===
"
undefined
"
)
{
throw
new
TypeError
(
'
rooms.open: You need to provide at least one JID
'
);
throw
new
TypeError
(
'
rooms.open: You need to provide at least one JID
'
);
}
else
if
(
typeof
jids
===
"
string
"
)
{
}
else
if
(
typeof
jids
===
"
string
"
)
{
return
_transform
(
jids
,
nick
,
fetcher
);
return
_transform
(
jids
,
attrs
,
fetcher
);
}
}
return
_
.
map
(
jids
,
_
.
partial
(
_transform
,
_
,
nick
,
fetcher
));
return
_
.
map
(
jids
,
_
.
partial
(
_transform
,
_
,
attrs
,
fetcher
));
},
},
'
get
'
:
function
(
jids
,
nick
,
create
)
{
'
get
'
:
function
(
jids
,
attrs
,
create
)
{
if
(
typeof
attrs
===
"
string
"
)
{
attrs
=
{
'
nick
'
:
attrs
};
}
else
if
(
typeof
attrs
===
"
undefined
"
)
{
attrs
=
{};
}
if
(
typeof
jids
===
"
undefined
"
)
{
if
(
typeof
jids
===
"
undefined
"
)
{
var
result
=
[];
var
result
=
[];
converse
.
chatboxes
.
each
(
function
(
chatbox
)
{
converse
.
chatboxes
.
each
(
function
(
chatbox
)
{
...
@@ -1657,13 +1666,13 @@
...
@@ -1657,13 +1666,13 @@
return
result
;
return
result
;
}
}
var
fetcher
=
_
.
partial
(
converse
.
chatboxviews
.
getChatBox
.
bind
(
converse
.
chatboxviews
),
_
,
create
);
var
fetcher
=
_
.
partial
(
converse
.
chatboxviews
.
getChatBox
.
bind
(
converse
.
chatboxviews
),
_
,
create
);
if
(
!
nick
)
{
if
(
!
attrs
.
nick
)
{
nick
=
Strophe
.
getNodeFromJid
(
converse
.
bare_jid
);
attrs
.
nick
=
Strophe
.
getNodeFromJid
(
converse
.
bare_jid
);
}
}
if
(
typeof
jids
===
"
string
"
)
{
if
(
typeof
jids
===
"
string
"
)
{
return
_transform
(
jids
,
nick
,
fetcher
);
return
_transform
(
jids
,
attrs
,
fetcher
);
}
}
return
_
.
map
(
jids
,
_
.
partial
(
_transform
,
_
,
nick
,
fetcher
));
return
_
.
map
(
jids
,
_
.
partial
(
_transform
,
_
,
attrs
,
fetcher
));
}
}
}
}
});
});
...
...
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