private void addMailboxList(JSONObject response) {
    JSONObject inbox = response.optJSONObject("inbox");
    if (inbox != null) {
      messageCount = inbox.optInt("message_count");
      unreadCount = inbox.optInt("unread_count");

      m_mailboxUnread.setText(String.valueOf(unreadCount));
      m_mailboxUnread.setVisibility(unreadCount > 0 ? View.VISIBLE : View.GONE);
      m_application.setMailUnreadCount(unreadCount);

      currentPage = inbox.optInt("page");
      JSONArray messages = inbox.optJSONArray("messages");
      if (messages != null) {
        for (int i = 0; i < messages.length(); i++) {
          JSONObject message = messages.optJSONObject(i);
          glitchMail mail = new glitchMail();

          mail.id = message.optInt("message_id");
          mail.currants = message.optInt("currants");
          mail.text = message.optString("text");
          if (mail.text.equalsIgnoreCase("null")) {
            mail.text = "";
          }
          mail.received = message.optLong("received");
          mail.replied = message.optInt("replied") == 1;
          mail.is_expedited = message.optBoolean("is_expedited");
          mail.is_read = message.optBoolean("is_read");

          JSONObject sender = message.optJSONObject("sender");
          if (sender != null) {
            mail.sender_tsid = sender.optString("tsid");
            mail.sender_label = sender.optString("label");
            mail.sender_avatar = sender.optString("singles_url");
          }

          JSONObject item = message.optJSONObject("item");
          if (item != null) {
            mail.item = new glitchMailItem();
            mail.item.tsid = item.optString("class_tsid");
            mail.item.name = item.optString("name");
            mail.item.count = item.optInt("count");
            mail.item.desc = item.optString("desc");
            mail.item.icon = item.optString("icon");
          }

          m_mailList.add(mail);
        }
      }
    }
  }