MCPcopy Index your code
hub / github.com/BombusMod/BombusMod / cmdOk

Method cmdOk

src/main/java/Client/ContactEdit.java:184–233  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

182 }
183
184 public void cmdOk() {
185 String jid = tJid.getValue().trim().toLowerCase();
186 if (jid != null) {
187 String name = tNick.getValue();
188 String group = group(tGrpList.getSelectedIndex());
189
190 if (tGrpList.getSelectedIndex() == tGrpList.size() - 1) {
191 group = tGroup.getValue();
192 }
193
194 boolean ask = tAskSubscrCheckBox.getValue();
195//#ifdef PRIVACY
196 if (!sd.account.isGoogle) {
197 if (QuickPrivacy.groupsList == null) {
198 QuickPrivacy.groupsList = new Vector();
199 }
200 if (!QuickPrivacy.groupsList.contains(group)) {
201 QuickPrivacy.groupsList.addElement(group);
202 new QuickPrivacy().updateQuickPrivacyList();
203 }
204 }
205//#endif
206
207
208 if (group.equals(SR.MS_GENERAL)) {
209 group = "";
210 }
211
212 int at = jid.indexOf('@');
213 if (at < 0 && tTranspList.getSelectedIndex() != tTranspList.size() - 1) {
214 StringBuffer jidBuf = new StringBuffer(jid);
215 at = jid.length();
216 jidBuf.setLength(at);
217 jidBuf.append('@').append((String) tTranspList.items.elementAt(tTranspList.getSelectedIndex()));
218 jid = jidBuf.toString();
219 }
220 Jid newJid = new Jid(jid);
221 if (!newJid.equals(StaticData.getInstance().roster.selfContact().jid, false)) {
222 Contact c = sd.roster.getContact(newJid.getBare(), true);
223 Group grp = sd.roster.groups.getGroup(group);
224 if (grp == null) {
225 grp = sd.roster.groups.addGroup(group, Groups.TYPE_COMMON);
226 }
227 c.group = grp;
228 c.nick = name;
229 sd.roster.storeContact(c, ask);
230 }
231 destroyView();
232 }
233 }
234
235 protected void beginPaint() {
236 if (tGrpList != null) {

Callers

nothing calls this directly

Calls 15

groupMethod · 0.95
equalsMethod · 0.95
getInstanceMethod · 0.95
getBareMethod · 0.95
toLowerCaseMethod · 0.80
getSelectedIndexMethod · 0.80
addElementMethod · 0.80
appendMethod · 0.80
selfContactMethod · 0.80
addGroupMethod · 0.80
storeContactMethod · 0.80

Tested by

no test coverage detected