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

Method parseMessage

src/main/java/Messages/MessageParser.java:195–379  ·  view source on GitHub ↗
(final MessageItem task, final int windowWidth, String txt, boolean isSubj)

Source from the content-addressed store, hash-verified

193 }
194
195 private void parseMessage(final MessageItem task, final int windowWidth, String txt, boolean isSubj) {
196 if (null == txt) return;
197
198 Vector lines=task.msgLines;
199 boolean singleLine=task.msg.itemCollapsed;
200
201 boolean underline=false;
202
203 Leaf smileRoot=emptyRoot;
204//#ifdef SMILES
205 if (task.smilesEnabled() && !isSubj) smileRoot = root;
206//#endif
207
208 int w=0;
209 StringBuffer s=new StringBuffer();
210 int wordWidth=0;
211 int wordStartPos=0;
212//#ifdef SMILES
213 ComplexString l=new ComplexString(smileImages);
214//#else
215//# ComplexString l=new ComplexString();
216//#endif
217 lines.addElement(l);
218
219 Font f=getFont((task.msg.highlite || isSubj));
220 l.setFont(f);
221
222 int color=ColorTheme.getColor(isSubj ? ColorTheme.NICK_COLOR : ColorTheme.LIST_INK);
223 l.setColor(color);
224
225 int pos=0;
226 int textLength = txt.length();
227 while (pos < textLength) {
228 int smileIndex=-1;
229 int smileStartPos=pos;
230 int smileEndPos=pos;
231 char c = txt.charAt(pos);
232
233 if (underline) {
234 switch (c) {
235 case ' ':
236 case 0x09:
237 case 0x0d:
238 case 0x0a:
239 case 0xa0:
240 case ')':
241 underline=false;
242 if (wordStartPos!=pos) {
243 s.append(txt.substring(wordStartPos, pos));
244 wordStartPos = pos;
245 w += wordWidth;
246 wordWidth=0;
247 }
248 if (s.length()>0) {
249 l.addUnderline();
250 l.addElement(s.toString());
251 s = new StringBuffer();
252 }

Callers 1

parseMsgMethod · 0.95

Calls 15

addElementMethod · 0.95
getFontMethod · 0.95
setFontMethod · 0.95
getColorMethod · 0.95
setColorMethod · 0.95
addUnderlineMethod · 0.95
findChildMethod · 0.95
addImageMethod · 0.95
charWidthMethod · 0.95
smilesEnabledMethod · 0.80
appendMethod · 0.80
getWidthMethod · 0.65

Tested by

no test coverage detected