How to use the deltachat-node/constants.DC_CONTACT_ID_SELF function in deltachat-node

To help you get started, weโ€™ve selected a few deltachat-node examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github deltachat / deltachat-desktop / src / renderer / components / map / MapComponent.js View on Github external
const { selectedChat } = this.props
    if (!this.poiLocation) {
      return
    }
    const latLng = Object.assign({}, this.poiLocation)
    callDcMethod(
      'messageList.sendMessage',
      [selectedChat.id, message, null, latLng]
    )
    if (this.contextMenuPopup) {
      this.contextMenuPopup.remove()
      this.contextMenuPopup = null
    }
    let contact = selectedChat.contacts.find(contact => contact.address === this.currentUserAddress)
    if (!contact) {
      contact = { id: C.DC_CONTACT_ID_SELF, firstName: window.translate('self'), color: 1212112 } // fallback since current user is not in contact list in non group chats
    }
    const location = {
      longitude: latLng.lng,
      latitude: latLng.lat,
      contact: contact,
      timestamp: new Date().getUTCMilliseconds(),
      isIndependent: true,
      message: message
    }
    const mapData = this.mapDataStore.get(contact.id)
    if (mapData) {
      this.map.getSource(mapData.pointsLayerId).setData(MapLayerFactory.getGeoJSONPointsLayerSourceData([location], contact, true))
    } else {
      this.renderContactLayer(contact, [location])
    }
    this.poiLocation = null
github deltachat / deltachat-desktop / src / main / deltachat.js View on Github external
messageIdToJson (id) {
    const msg = this._dc.getMessage(id)
    const filemime = msg.getFilemime()
    const filename = msg.getFilename()
    const filesize = msg.getFilebytes()
    const fromId = msg.getFromId()
    const isMe = fromId === C.DC_CONTACT_ID_SELF
    const setupCodeBegin = msg.getSetupcodebegin()
    const contact = fromId ? this._dc.getContact(fromId).toJson() : {}
    if (contact.color) {
      contact.color = this._integerToHexColor(contact.color)
    }

    return {
      id,
      msg: msg.toJson(),
      filemime,
      filename,
      filesize,
      fromId,
      isMe,
      contact,
      isInfo: msg.isInfo(),
github deltachat / deltachat-desktop / src / renderer / components / EditGroup.js View on Github external
      .filter(id => id !== C.DC_CONTACT_ID_SELF)
      .map(id => Number(id))
github deltachat / deltachat-desktop / src / main / deltachat / chat.js View on Github external
leaveGroup (chatId) {
    log.debug(`action - leaving chat ${chatId}`)
    this._dc.removeContactFromChat(chatId, C.DC_CONTACT_ID_SELF)
  }
github deltachat / deltachat-desktop / src / renderer / components / Contact.js View on Github external
function convertContactProps (contact) {
  return {
    name: contact.name,
    phoneNumber: contact.address,
    avatarPath: contact.profileImage,
    profileName: contact.displayName,
    isMe: contact.id === DCConstants.DC_CONTACT_ID_SELF,
    verified: contact.isVerified
  }
}
github deltachat / deltachat-desktop / src / renderer / components / dialogs / Settings.js View on Github external
const advancedSettings = {
      mail_user: settings['configured_mail_user'],
      mail_server: settings['configured_mail_server'],
      mail_port: settings['configured_mail_port'],
      mail_security: settings['configured_mail_security'],
      imap_certificate_checks: settings['configured_imap_certificate_checks'],
      send_user: settings['configured_send_user'],
      send_pw: settings['configured_send_pw'],
      send_server: settings['configured_send_server'],
      send_port: settings['configured_send_port'],
      send_security: settings['configured_send_security'],
      smtp_certificate_checks: settings['configured_smtp_certificate_checks'],
      e2ee_enabled: settings['configured_e2ee_enabled']
    }

    const selfContact = await callDcMethodAsync('getContact', [C.DC_CONTACT_ID_SELF])

    this.setState({ settings, advancedSettings, selfContact })
  }
github deltachat / deltachat-desktop / src / main / deltachat / messagelist.js View on Github external
messageToJson (msg) {
    const filemime = msg.getFilemime()
    const filename = msg.getFilename()
    const filesize = msg.getFilebytes()
    const viewType = msg.getViewType()
    const fromId = msg.getFromId()
    const isMe = fromId === C.DC_CONTACT_ID_SELF
    const setupCodeBegin = msg.getSetupcodebegin()
    const contact = fromId ? this._dc.getContact(fromId).toJson() : {}
    if (contact.color) {
      contact.color = integerToHexColor(contact.color)
    }
    return convert({
      id: msg.id,
      msg: msg.toJson(),
      filemime,
      filename,
      filesize,
      viewType,
      fromId,
      isMe,
      contact,
      isInfo: msg.isInfo(),
github deltachat / deltachat-desktop / src / main / deltachat / controller.js View on Github external
getProfilePicture () {
    return this._dc.getContact(C.DC_CONTACT_ID_SELF).getProfileImage()
  }
github deltachat / deltachat-desktop / src / main / deltachat / chatlist.js View on Github external
color: integerToHexColor(chat.color),
      lastUpdated: lastUpdated,
      summary: {
        text1: summary.text1,
        text2: summary.text2,
        status: mapCoreMsgStatus2String(summary.state)
      },
      deaddrop: chat.deaddrop,
      isVerified: chat.isVerified,
      isGroup: isGroup,
      freshMessageCounter: this._dc.getFreshMessageCount(chatId),
      isArchiveLink: chat.id === C.DC_CHAT_ID_ARCHIVED_LINK,
      contactIds,
      isSelfTalk: chat.isSelfTalk,
      isDeviceTalk: chat.isDeviceTalk,
      selfInGroup: isGroup && contactIds.indexOf(C.DC_CONTACT_ID_SELF) !== -1
    }
  }