XMPP Instant Messaging - Group Rosters: Difference between revisions
(Added a test so that the script doesn't try to add members to their own XMPP contact lists.) |
(Added name lookup so that display names are added to buddy lists rather than email addresses.) |
||
Line 19: | Line 19: | ||
if [ $member != $target ] | if [ $member != $target ] | ||
then | then | ||
uname=$(zmmailbox -z -m $target gid -v | \ | |||
grep zimbraPrefFromDisplay | \ | |||
sed -e 's/.*: "\(.*\)",/\1/') | |||
zmsoap --type im --verbose --zadmin \ | zmsoap --type im --verbose --zadmin \ | ||
--mailbox $member IMSubscribeRequest \ | --mailbox $member IMSubscribeRequest \ | ||
@addr=$target @op="add" | @addr=$target @name=$uname @op="add" | ||
zmsoap --type im --verbose --zadmin \ | zmsoap --type im --verbose --zadmin \ |
Revision as of 21:15, 8 February 2010
As of ZCS 6.0, it's not possible to create group rosters (where the IM Buddy List is pre-populated with all the members of a group) through the admin web interface. This functionality is slated for ZCS 7.0. However, it is possible to do so via the IM SOAP API.
The following bash script, which should be run from the CLI as the zimbra user, will reciprocally add all members of a Distribution List (defined in the admin web interface). It's not elegant, but it works.
#!/bin/bash if [ "$#" == "1" ] then members=$(zmsoap --type admin --verbose --zadmin \ GetDistributionListRequest/dl="$1" @by="name" | \ grep dlm | sed -e 's/.*<dlm>\(.*\)<\/dlm>/\1/g') for member in $members do for target in $members do if [ $member != $target ] then uname=$(zmmailbox -z -m $target gid -v | \ grep zimbraPrefFromDisplay | \ sed -e 's/.*: "\(.*\)",/\1/') zmsoap --type im --verbose --zadmin \ --mailbox $member IMSubscribeRequest \ @addr=$target @name=$uname @op="add" zmsoap --type im --verbose --zadmin \ --mailbox $target IMAuthorizeSubscribeRequest \ @addr=$member @authorized="true" fi done done else echo "$0 usage: $0 group@zimbra.domain.edu" fi