message Builder with encoded url
This commit is contained in:
parent
c971c05de3
commit
61527b9737
|
@ -98,13 +98,21 @@ public class MessageBuilder {
|
|||
throw new IllegalArgumentException("attachment empty!");
|
||||
}
|
||||
attachmenttype = type;
|
||||
attachment = cont;
|
||||
try {
|
||||
attachment = URLEncoder.encode(cont, "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public MessageBuilder setCaption(String text) {
|
||||
this.caption = text;
|
||||
try {
|
||||
this.caption = URLEncoder.encode(text, "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -130,10 +138,10 @@ public class MessageBuilder {
|
|||
String cmd;
|
||||
String text = "";
|
||||
if(attachmenttype != Attachment.none) {
|
||||
attachment = "&" + attachmenttype.name().toLowerCase() + "=" + this.attachment;
|
||||
cmd = "send" + attachmenttype.name();
|
||||
if(caption != null)
|
||||
attachment += "&caption=" + caption;
|
||||
attachment = "&" + attachmenttype.name().toLowerCase() + "=" + this.attachment;
|
||||
cmd = "send" + attachmenttype.name();
|
||||
} else {
|
||||
cmd = "sendMessage";
|
||||
if(this.text != null) {
|
||||
|
|
Loading…
Reference in New Issue