MCPcopy Create free account
hub / github.com/M66B/FairEmail / getTld

Method getTld

app/src/main/java/eu/faircode/email/UriHelper.java:153–177  ·  view source on GitHub ↗
(Context context, @NonNull String host)

Source from the content-addressed store, hash-verified

151 }
152
153 static String getTld(Context context, @NonNull String host) {
154 ensureSuffixList(context);
155
156 String eval = host.toLowerCase(Locale.ROOT);
157 while (true) {
158 int d = eval.indexOf('.');
159 String w = (d < 0 ? null : '*' + eval.substring(d));
160
161 synchronized (suffixList) {
162 if (suffixList.contains(eval))
163 return eval;
164 if (suffixList.contains(w))
165 if (suffixList.contains('!' + eval))
166 return eval.substring(d + 1);
167 else
168 return eval;
169 }
170
171 int dot = eval.indexOf('.');
172 if (dot < 0)
173 return null;
174
175 eval = eval.substring(dot + 1);
176 }
177 }
178
179 static String getEmailUser(String address) {
180 if (address == null)

Callers 6

getParentDomainMethod · 0.95
getRootDomainMethod · 0.95
isTldMethod · 0.95
hasTldMethod · 0.95
testMethod · 0.95
bindToMethod · 0.95

Calls 3

ensureSuffixListMethod · 0.95
indexOfMethod · 0.80
containsMethod · 0.45

Tested by

no test coverage detected