code: public void doSendDocument(Peer peer, String fileName, String mimeType, int fileSize,
                                 FastThumb fastThumb, String descriptor) {
          long rid = RandomUtils.nextRid();
          long date = createPendingDate();
          long sortDate = date + 365 * 24 * 60 * 60 * 1000L;
          DocumentContent documentContent = DocumentContent.createLocal(fileName, fileSize,
                  descriptor, mimeType, fastThumb);
  
          Message message = new Message(rid, sortDate, date, myUid(), MessageState.PENDING, documentContent);
          context().getMessagesModule().getRouter().onOutgoingMessage(peer, message);
  
          pendingMessages.getPendingMessages().add(new PendingMessage(peer, rid, documentContent));
          savePending();
  
          performUploadFile(rid, descriptor, fileName);
      }
docs: Sending documents