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

Method addMessage

src/main/java/Client/Contact.java:349–474  ·  view source on GitHub ↗
(Msg m)

Source from the content-addressed store, hash-verified

347 }
348
349 public void addMessage(Msg m) {
350 boolean last_replace = false;
351 if (origin == ORIGIN_GROUPCHAT) {
352 if (!m.body.startsWith("/me ")) {
353 if (cf.showNickNames && !m.isPresence() && m.messageType != Msg.MESSAGE_TYPE_SUBJ && m.messageType != Msg.MESSAGE_TYPE_SYSTEM) {
354 StringBuffer who = new StringBuffer();
355 Msg.appendNick(who, m.from + ((cf.hideTimestamps) ? ":" : " ("+m.getTime() + ")" + ":"));
356 if (m.subject != null) {
357 who.append("\n").append(m.subject);
358 }
359 m.subject = who.toString();
360 }
361 }
362 if (m.body.startsWith("/me ")) {
363 StringBuffer b = new StringBuffer();
364 Msg.appendNick(b, m.from);
365 b.insert(0, '*');
366 b.append(m.body.substring(3));
367 m.body = b.toString();
368 b = null;
369 }
370 status = Presence.PRESENCE_ONLINE;
371//#ifdef LOGROTATE
372 redraw = deleteOldMessages();
373//#endif
374 }
375//#ifdef STATUSES_WINDOW
376//# if (m.isPresence()) {
377//# statuses.addElement(new MessageItem(m, smiles));
378//# }
379//#endif
380 if (origin != ORIGIN_GROUPCHAT) {
381 if (msgs.size() > 0 && m.isPresence()) {
382 Object item = msgs.lastElement();
383 if (item != null) {
384 if (((MessageItem) item).msg.isPresence()) {
385 last_replace = true;
386 }
387 }
388 } else {
389 if (!m.body.startsWith("/me ")) {
390 if (cf.showNickNames && !m.isPresence()) {
391 StringBuffer who = new StringBuffer();
392 Msg.appendNick(who, m.messageType == Msg.MESSAGE_TYPE_OUT ? sd.account.getNickName() + ((cf.hideTimestamps) ? ":" : " (" + m.getTime() + ")" + ":") : getName() + ((cf.hideTimestamps) ? ":" : " ("+m.getTime() + ")" + ":"));
393 if (m.subject != null) {
394 who.append("\n").append(m.subject);
395 }
396 m.subject = who.toString();
397 }
398 } else { // if (m.body.startsWith("/me "))
399 StringBuffer b = new StringBuffer();
400 Msg.appendNick(b, (m.messageType == Msg.MESSAGE_TYPE_OUT) ? sd.account.getNickName() : getName());
401 b.insert(0, '*');
402 b.append(m.body.substring(3));
403 m.body = b.toString();
404 }
405 }
406 } else {

Callers 6

blockArrivedMethod · 0.95
doActionMethod · 0.95
SearchResultMethod · 0.45
messageStoreMethod · 0.45
menuActionMethod · 0.45
sendMethod · 0.45

Calls 15

appendNickMethod · 0.95
deleteOldMessagesMethod · 0.95
getNameMethod · 0.95
isTransportMethod · 0.95
getInstanceMethod · 0.95
isPresenceMethod · 0.80
getTimeMethod · 0.80
appendMethod · 0.80
getBareMethod · 0.80
setElementAtMethod · 0.80
addElementMethod · 0.80
insertMethod · 0.65

Tested by

no test coverage detected