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

Method deleteContact

src/main/java/Client/Roster.java:2079–2124  ·  view source on GitHub ↗
(Contact c)

Source from the content-addressed store, hash-verified

2077 }
2078
2079 public void deleteContact(Contact c) {
2080 synchronized (hContacts) {
2081 int j = hContacts.size();
2082 for (int i = 0; i < j; i++) {
2083 Contact c2 = (Contact) hContacts.elementAt(i);
2084 if (c.jid.equals(c2.jid, false)) {
2085 c2.setStatus(Presence.PRESENCE_TRASH);
2086 c2.offline_type = Presence.PRESENCE_TRASH;
2087 }
2088 }
2089
2090 if (c.getGroupType() == Groups.TYPE_NOT_IN_LIST) {
2091 hContacts.removeElement(c);
2092 countNewMsgs();
2093 reEnumRoster();
2094 } else {
2095 sd.getTheStream().send(RosterDispatcher.QueryRoster(c.jid, null, null, "remove"));
2096 if (JidUtils.isTransport(c.jid)) {
2097 // for buggy transports
2098 sendPresence(c.jid.toString(), "unsubscribe", null, false);
2099 sendPresence(c.jid.toString(), "unsubscribed", null, false);
2100 }
2101 sendPresence(c.jid.getBare(), "unsubscribe", null, false);
2102 sendPresence(c.jid.getBare(), "unsubscribed", null, false);
2103 }
2104 }
2105 if (JidUtils.isTransport(c.jid)) {
2106 // double-check for empty jid or our server jid
2107 if (c.jid.getBare().length() == 0) {
2108 return;
2109 }
2110 if (c.jid.getBare().equals(myJid.getServer())) {
2111 return;
2112 }
2113 // automatically remove registration
2114 JabberDataBlock unreg = new Iq(c.jid.getBare(), Iq.TYPE_SET, "unreg" + System.currentTimeMillis());
2115 JabberDataBlock query = unreg.addChildNs("query", "jabber:iq:register");
2116 query.addChild("remove", null);
2117 sd.getTheStream().send(unreg);
2118 // and for buggy transports
2119 JabberDataBlock unreg2 = new Iq(c.jid.toString(), Iq.TYPE_SET, "unreg" + System.currentTimeMillis());
2120 JabberDataBlock query2 = unreg2.addChildNs("query", "jabber:iq:register");
2121 query2.addChild("remove", null);
2122 sd.getTheStream().send(unreg2);
2123 }
2124 }
2125
2126 public void setQuerySign(boolean requestState) {
2127 querysign = requestState;

Callers 3

deleteGroupMethod · 0.95
yesMethod · 0.95
yesMethod · 0.80

Calls 15

setStatusMethod · 0.95
countNewMsgsMethod · 0.95
reEnumRosterMethod · 0.95
QueryRosterMethod · 0.95
isTransportMethod · 0.95
sendPresenceMethod · 0.95
addChildMethod · 0.95
getGroupTypeMethod · 0.80
getTheStreamMethod · 0.80
getBareMethod · 0.80
getServerMethod · 0.80
addChildNsMethod · 0.80

Tested by

no test coverage detected