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

Method getBodyBytes

src/main/java/History/HistoryAppend.java:111–140  ·  view source on GitHub ↗
(Msg m)

Source from the content-addressed store, hash-verified

109 }
110
111 private byte[] getBodyBytes(Msg m) {
112 String fromName = StaticData.getInstance().account.JID.getNode();
113 if (m.messageType != Msg.MESSAGE_TYPE_OUT) {
114 fromName = m.from;
115 }
116
117 StringBuffer body = new StringBuffer();
118
119 int marker = MESSAGE_MARKER_OTHER;
120 switch (m.messageType) {
121 case Msg.MESSAGE_TYPE_IN:
122 marker = MESSAGE_MARKER_IN;
123 break;
124 case Msg.MESSAGE_TYPE_PRESENCE:
125 marker = MESSAGE_MARKER_PRESENCE;
126 break;
127 case Msg.MESSAGE_TYPE_OUT:
128 marker = MESSAGE_MARKER_OUT;
129 }
130
131 body.append(MS).append(TS).append(marker).append(TE).append(DS)
132 .append(m.getDayTime()).append(DE).append(FS)
133 .append(StringUtils.escapeTags(fromName)).append(FE);
134 if (m.subject != null) {
135 body.append(SS).append(StringUtils.escapeTags(m.subject)).append(SE);
136 }
137 body.append(BS).append(StringUtils.escapeTags(m.body)).append(BE).append(ME).append(RN);
138
139 return Strconv.toUTFArray(body.toString());
140 }
141}
142
143//#endif

Callers 1

addMessageMethod · 0.95

Calls 7

getInstanceMethod · 0.95
escapeTagsMethod · 0.95
toUTFArrayMethod · 0.95
appendMethod · 0.80
getDayTimeMethod · 0.80
getNodeMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected