Software /
code /
prosody-modules
Comparison
mod_adhoc_groups/mod_adhoc_groups.lua @ 2870:d8325dfb6a13
mod_adhoc_groups: Fix typos [codespell]
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 04 Feb 2018 15:57:52 +0100 |
parent | 2848:232da6b1d2c1 |
child | 4030:0d7293c37e1a |
comparison
equal
deleted
inserted
replaced
2869:77498ea07795 | 2870:d8325dfb6a13 |
---|---|
89 end | 89 end |
90 | 90 |
91 local group, err = groups:get(fields.group); | 91 local group, err = groups:get(fields.group); |
92 if group then | 92 if group then |
93 if err then | 93 if err then |
94 return false, "An error occured on the server. Please try again later."; | 94 return false, "An error occurred on the server. Please try again later."; |
95 else | 95 else |
96 return false, "That group already exists"; | 96 return false, "That group already exists"; |
97 end | 97 end |
98 end | 98 end |
99 | 99 |
100 if not groups:set(fields.group, { [user] = true }) then | 100 if not groups:set(fields.group, { [user] = true }) then |
101 return false, "An error occured while creating the group"; | 101 return false, "An error occurred while creating the group"; |
102 end | 102 end |
103 | 103 |
104 return true, ("The %s group has been created"):format(fields.group); | 104 return true, ("The %s group has been created"):format(fields.group); |
105 end)), "local_user")); -- Maybe admins only? | 105 end)), "local_user")); -- Maybe admins only? |
106 | 106 |
124 end | 124 end |
125 | 125 |
126 local group, err = groups:get(fields.group); | 126 local group, err = groups:get(fields.group); |
127 if not group then | 127 if not group then |
128 if err then | 128 if err then |
129 return false, "An error occured on the server. Please try again later."; | 129 return false, "An error occurred on the server. Please try again later."; |
130 else | 130 else |
131 return false, "No such group"; | 131 return false, "No such group"; |
132 end | 132 end |
133 end | 133 end |
134 if group[data.from] then | 134 if group[data.from] then |
135 return false, "You are already in this group."; | 135 return false, "You are already in this group."; |
136 end | 136 end |
137 | 137 |
138 if not memberships:set(fields.group, user, true) then | 138 if not memberships:set(fields.group, user, true) then |
139 return false, "An error occured while adding you to the group"; | 139 return false, "An error occurred while adding you to the group"; |
140 end | 140 end |
141 | 141 |
142 for member in pairs(group) do | 142 for member in pairs(group) do |
143 if member ~= user then | 143 if member ~= user then |
144 subscribe(user, member); | 144 subscribe(user, member); |