Example #1
0
 public static final String formatString(String replyContent, String authorName, Context context) {
   String finalString = formatSingleLine(replyContent);
   if (authorName != null) {
     finalString += '\n' + "¡¾ÔÚ[uid]" + authorName + "[/uid]µÄ´ó×÷ÖÐÌáµ½¡¿";
   }
   String sign = DatabaseDealer.getSettings(context).getSign();
   if (sign != null && sign.length() > 0) {
     finalString += ('\n' + "-" + '\n' + sign);
   }
   return finalString;
 }
Example #2
0
 public static void sendMail(String post2, String content, Context context) throws IOException {
   LoginInfo loginInfo = LoginInfo.getInstance(context);
   HttpResponse httpResponse;
   String newUrl =
       "http://bbs.nju.edu.cn/" + loginInfo.getLoginCode() + "/bbssndmail?pid=0&userid=" + post2;
   HttpPost httpRequest = new HttpPost(newUrl);
   ArrayList<NameValuePair> postData = new ArrayList<NameValuePair>();
   postData.add(new BasicNameValuePair("action", "bbssndmail?pid=0&userid=" + post2));
   postData.add(new BasicNameValuePair("signature", "1"));
   postData.add(new BasicNameValuePair("text", content));
   postData.add(new BasicNameValuePair("title", "Õ¾ÄÚÐÅ"));
   postData.add(new BasicNameValuePair("userid", post2));
   httpRequest.addHeader("Cookie", loginInfo.getLoginCookie());
   httpRequest.setEntity(new UrlEncodedFormEntity(postData, "GB2312"));
   httpResponse = new DefaultHttpClient().execute(httpRequest);
   if (httpResponse.getStatusLine().getStatusCode() == 200) {
     Mail mail =
         new Mail(post2, content, System.currentTimeMillis(), true, Constants.MAIL_TYPE_SENT);
     List<Mail> mailList = new ArrayList<Mail>();
     mailList.add(mail);
     DatabaseDealer.insertMails(context, mailList);
   }
 }