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
7199e63f
Commit
7199e63f
authored
Jan 22, 2021
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move converse-profile plugin into folder
parent
85bd192f
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
114 additions
and
113 deletions
+114
-113
src/converse.js
src/converse.js
+1
-1
src/plugins/omemo.js
src/plugins/omemo.js
+1
-1
src/plugins/profile.js
src/plugins/profile.js
+0
-110
src/plugins/profile/index.js
src/plugins/profile/index.js
+33
-0
src/plugins/profile/statusview.js
src/plugins/profile/statusview.js
+78
-0
src/plugins/profile/templates/profile.js
src/plugins/profile/templates/profile.js
+1
-1
No files found.
src/converse.js
View file @
7199e63f
...
...
@@ -23,7 +23,7 @@ import "./plugins/muc-views/index.js"; // Views related to MUC
import
"
./plugins/headlines-view/index.js
"
;
import
"
./plugins/notifications.js
"
;
import
"
./plugins/omemo.js
"
;
import
"
./plugins/profile.js
"
;
import
"
./plugins/profile
/index
.js
"
;
import
"
./plugins/push.js
"
;
// XEP-0357 Push Notifications
import
"
./plugins/register/index.js
"
;
// XEP-0077 In-band registration
import
"
./plugins/roomslist/index.js
"
;
// Show currently open chat rooms
...
...
src/plugins/omemo.js
View file @
7199e63f
...
...
@@ -5,7 +5,7 @@
*/
/* global libsignal */
import
"
./profile.js
"
;
import
"
./profile
/index
.js
"
;
import
'
../modals/user-details.js
'
;
import
log
from
"
@converse/headless/log
"
;
import
{
Collection
}
from
"
@converse/skeletor/src/collection
"
;
...
...
src/plugins/profile.js
deleted
100644 → 0
View file @
85bd192f
/**
* @module converse-profile
* @copyright The Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/
import
"
../modals/chat-status.js
"
;
import
"
../modals/profile.js
"
;
import
"
./modal.js
"
;
import
"
@converse/headless/plugins/status
"
;
import
"
@converse/headless/plugins/vcard
"
;
import
UserSettingsModal
from
"
../modals/user-settings
"
;
import
tpl_profile
from
"
../templates/profile.js
"
;
import
{
__
}
from
'
../i18n
'
;
import
{
_converse
,
api
,
converse
}
from
"
@converse/headless/core
"
;
converse
.
plugins
.
add
(
'
converse-profile
'
,
{
dependencies
:
[
"
converse-status
"
,
"
converse-modal
"
,
"
converse-vcard
"
,
"
converse-chatboxviews
"
],
initialize
()
{
/* The initialize function gets called as soon as the plugin is
* loaded by converse.js's plugin machinery.
*/
api
.
settings
.
extend
({
'
allow_adhoc_commands
'
:
true
,
'
show_client_info
'
:
true
});
_converse
.
XMPPStatusView
=
_converse
.
ViewWithAvatar
.
extend
({
tagName
:
"
div
"
,
events
:
{
"
click a.show-profile
"
:
"
showProfileModal
"
,
"
click a.change-status
"
:
"
showStatusChangeModal
"
,
"
click .logout
"
:
"
logOut
"
},
initialize
()
{
this
.
listenTo
(
this
.
model
,
"
change
"
,
this
.
render
);
this
.
listenTo
(
this
.
model
.
vcard
,
"
change
"
,
this
.
render
);
},
toHTML
()
{
const
chat_status
=
this
.
model
.
get
(
'
status
'
)
||
'
offline
'
;
return
tpl_profile
(
Object
.
assign
(
this
.
model
.
toJSON
(),
this
.
model
.
vcard
.
toJSON
(),
{
chat_status
,
'
fullname
'
:
this
.
model
.
vcard
.
get
(
'
fullname
'
)
||
_converse
.
bare_jid
,
"
showUserSettingsModal
"
:
ev
=>
this
.
showUserSettingsModal
(
ev
),
'
status_message
'
:
this
.
model
.
get
(
'
status_message
'
)
||
__
(
"
I am %1$s
"
,
this
.
getPrettyStatus
(
chat_status
)),
}));
},
afterRender
()
{
this
.
renderAvatar
();
},
showProfileModal
(
ev
)
{
ev
.
preventDefault
();
api
.
modal
.
show
(
_converse
.
ProfileModal
,
{
model
:
this
.
model
},
ev
);
},
showStatusChangeModal
(
ev
)
{
ev
.
preventDefault
();
api
.
modal
.
show
(
_converse
.
ChatStatusModal
,
{
model
:
this
.
model
},
ev
);
},
showUserSettingsModal
(
ev
)
{
ev
.
preventDefault
();
api
.
modal
.
show
(
UserSettingsModal
,
{
model
:
this
.
model
,
_converse
},
ev
);
},
logOut
(
ev
)
{
ev
.
preventDefault
();
const
result
=
confirm
(
__
(
"
Are you sure you want to log out?
"
));
if
(
result
===
true
)
{
api
.
user
.
logout
();
}
},
getPrettyStatus
(
stat
)
{
if
(
stat
===
'
chat
'
)
{
return
__
(
'
online
'
);
}
else
if
(
stat
===
'
dnd
'
)
{
return
__
(
'
busy
'
);
}
else
if
(
stat
===
'
xa
'
)
{
return
__
(
'
away for long
'
);
}
else
if
(
stat
===
'
away
'
)
{
return
__
(
'
away
'
);
}
else
if
(
stat
===
'
offline
'
)
{
return
__
(
'
offline
'
);
}
else
{
return
__
(
stat
)
||
__
(
'
online
'
);
}
}
});
/******************** Event Handlers ********************/
api
.
listen
.
on
(
'
controlBoxPaneInitialized
'
,
async
view
=>
{
await
api
.
waitUntil
(
'
VCardsInitialized
'
);
_converse
.
xmppstatusview
=
new
_converse
.
XMPPStatusView
({
'
model
'
:
_converse
.
xmppstatus
});
view
.
el
.
insertAdjacentElement
(
'
afterBegin
'
,
_converse
.
xmppstatusview
.
render
().
el
);
});
}
});
src/plugins/profile/index.js
0 → 100644
View file @
7199e63f
/**
* @copyright The Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/
import
"
modals/chat-status.js
"
;
import
"
modals/profile.js
"
;
import
"
../modal.js
"
;
import
"
@converse/headless/plugins/status
"
;
import
"
@converse/headless/plugins/vcard
"
;
import
XMPPStatusView
from
'
./statusview.js
'
;
import
{
_converse
,
api
,
converse
}
from
"
@converse/headless/core
"
;
converse
.
plugins
.
add
(
'
converse-profile
'
,
{
dependencies
:
[
"
converse-status
"
,
"
converse-modal
"
,
"
converse-vcard
"
,
"
converse-chatboxviews
"
],
initialize
()
{
api
.
settings
.
extend
({
'
allow_adhoc_commands
'
:
true
,
'
show_client_info
'
:
true
});
_converse
.
XMPPStatusView
=
XMPPStatusView
;
/******************** Event Handlers ********************/
api
.
listen
.
on
(
'
controlBoxPaneInitialized
'
,
async
view
=>
{
await
api
.
waitUntil
(
'
VCardsInitialized
'
);
_converse
.
xmppstatusview
=
new
_converse
.
XMPPStatusView
({
'
model
'
:
_converse
.
xmppstatus
});
view
.
el
.
insertAdjacentElement
(
'
afterBegin
'
,
_converse
.
xmppstatusview
.
render
().
el
);
});
}
});
src/plugins/profile/statusview.js
0 → 100644
View file @
7199e63f
import
UserSettingsModal
from
"
modals/user-settings
"
;
import
ViewWithAvatar
from
'
shared/avatar.js
'
;
import
tpl_profile
from
"
./templates/profile.js
"
;
import
{
__
}
from
'
i18n
'
;
import
{
_converse
,
api
}
from
"
@converse/headless/core
"
;
const
XMPPStatusView
=
ViewWithAvatar
.
extend
({
tagName
:
"
div
"
,
events
:
{
"
click a.show-profile
"
:
"
showProfileModal
"
,
"
click a.change-status
"
:
"
showStatusChangeModal
"
,
"
click .logout
"
:
"
logOut
"
},
initialize
()
{
this
.
listenTo
(
this
.
model
,
"
change
"
,
this
.
render
);
this
.
listenTo
(
this
.
model
.
vcard
,
"
change
"
,
this
.
render
);
},
toHTML
()
{
const
chat_status
=
this
.
model
.
get
(
'
status
'
)
||
'
offline
'
;
return
tpl_profile
(
Object
.
assign
(
this
.
model
.
toJSON
(),
this
.
model
.
vcard
.
toJSON
(),
{
chat_status
,
'
fullname
'
:
this
.
model
.
vcard
.
get
(
'
fullname
'
)
||
_converse
.
bare_jid
,
"
showUserSettingsModal
"
:
ev
=>
this
.
showUserSettingsModal
(
ev
),
'
status_message
'
:
this
.
model
.
get
(
'
status_message
'
)
||
__
(
"
I am %1$s
"
,
this
.
getPrettyStatus
(
chat_status
)),
}));
},
afterRender
()
{
this
.
renderAvatar
();
},
showProfileModal
(
ev
)
{
ev
.
preventDefault
();
api
.
modal
.
show
(
_converse
.
ProfileModal
,
{
model
:
this
.
model
},
ev
);
},
showStatusChangeModal
(
ev
)
{
ev
.
preventDefault
();
api
.
modal
.
show
(
_converse
.
ChatStatusModal
,
{
model
:
this
.
model
},
ev
);
},
showUserSettingsModal
(
ev
)
{
ev
.
preventDefault
();
api
.
modal
.
show
(
UserSettingsModal
,
{
model
:
this
.
model
,
_converse
},
ev
);
},
logOut
(
ev
)
{
ev
.
preventDefault
();
const
result
=
confirm
(
__
(
"
Are you sure you want to log out?
"
));
if
(
result
===
true
)
{
api
.
user
.
logout
();
}
},
getPrettyStatus
(
stat
)
{
if
(
stat
===
'
chat
'
)
{
return
__
(
'
online
'
);
}
else
if
(
stat
===
'
dnd
'
)
{
return
__
(
'
busy
'
);
}
else
if
(
stat
===
'
xa
'
)
{
return
__
(
'
away for long
'
);
}
else
if
(
stat
===
'
away
'
)
{
return
__
(
'
away
'
);
}
else
if
(
stat
===
'
offline
'
)
{
return
__
(
'
offline
'
);
}
else
{
return
__
(
stat
)
||
__
(
'
online
'
);
}
}
});
export
default
XMPPStatusView
;
src/templates/profile.js
→
src/
plugins/profile/
templates/profile.js
View file @
7199e63f
import
{
__
}
from
'
../
i18n
'
;
import
{
__
}
from
'
i18n
'
;
import
{
api
}
from
"
@converse/headless/core
"
;
import
{
html
}
from
"
lit-html
"
;
...
...
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