How to use the deltachat-node/constants.DC_GCL_ADD_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 / dialogs / EditGroup.js View on Github external
export function EditGroupInner (props) {
  const { viewMode, setViewMode, onClose, chat } = props
  const tx = window.translate

  const [groupName, setGroupName] = useState(chat.name)
  const [groupImage, onSetGroupImage, onUnsetGroupImage] = useGroupImage(chat.profileImage)
  const [groupMembers, removeGroupMember, addGroupMember, addRemoveGroupMember] = useGroupMembers(chat.contacts)
  const [groupId, onUpdateGroup] = useEditGroup(false, groupName, groupImage, groupMembers, chat.id, onClose)

  const [qrCode, setQrCode] = useState('')
  const listFlags = chat.isVerified ? (C.DC_GCL_VERIFIED_ONLY | C.DC_GCL_ADD_SELF) : C.DC_GCL_ADD_SELF

  const [searchContacts, updateSearchContacts] = useContacts(listFlags, '')
  const [queryStr, onSearchChange, updateSearch] = useContactSearch(updateSearchContacts)
  const searchContactsToAdd = queryStr !== ''
    ? searchContacts.filter(({ id }) => groupMembers.indexOf(id) === -1).filter((_, i) => i < 5)
    : []

  const renderAddMemberIfNeeded = () => {
    if (queryStr !== '') return null
    return (
      <>
         setViewMode('addMember')} />
         {
          const qrCode = await callDcMethodAsync('chat.getQrCode', groupId)
          setQrCode(qrCode)
          setViewMode('showQrCode')
github deltachat / deltachat-desktop / src / renderer / components / dialogs / CreateChat.js View on Github external
export default function CreateChat (props) {
  const { isOpen, onClose } = props
  const tx = window.translate
  const { userFeedback } = useContext(ScreenContext)
  const [viewMode, setViewMode] = useState('main')

  const [contacts, updateContacts] = useContacts(C.DC_GCL_ADD_SELF, '')
  const [queryStr, onSearchChange] = useContactSearch(updateContacts)
  const queryStrIsEmail = isValidEmail(queryStr)

  const closeDialogAndSelectChat = chatId => {
    selectChat(chatId)
    onClose()
  }

  const chooseContact = async ({ id }) => {
    const chatId = await callDcMethodAsync('contacts.createChatByContactId', id)

    if (!chatId) {
      return userFeedback({ type: 'error', text: tx('create_chat_error_desktop') })
    }
    closeDialogAndSelectChat(chatId)
  }
github deltachat / deltachat-desktop / src / renderer / components / dialogs / CreateChat.js View on Github external
export function CreateVerifiedGroupInner (props) {
  const { viewMode, setViewMode, onClose } = props
  const tx = window.translate

  const [groupName, setGroupName] = useState('')
  const [groupImage, onSetGroupImage, onUnsetGroupImage] = useGroupImage()
  const [groupMembers, removeGroupMember, addGroupMember, addRemoveGroupMember] = useGroupMembers()
  const [groupId, lazilyCreateOrUpdateGroup, finishCreateGroup] = useCreateGroup(true, groupName, groupImage, groupMembers, onClose)

  const [qrCode, setQrCode] = useState('')

  const [searchContacts, updateSearchContacts] = useContacts(C.DC_GCL_VERIFIED_ONLY | C.DC_GCL_ADD_SELF, '')
  const [queryStr, onSearchChange, updateSearch] = useContactSearch(updateSearchContacts)
  const searchContactsToAdd = queryStr !== ''
    ? searchContacts.filter(({ id }) => groupMembers.indexOf(id) === -1).filter((_, i) => i < 5)
    : []

  const renderAddMemberIfNeeded = () => {
    if (queryStr !== '') return null
    return (
      <>
         setViewMode('createVerifiedGroup-addMember')} />
         {
          if (groupId === -1 && groupName === '') return
          const gId = await lazilyCreateOrUpdateGroup(false)
          const qrCode = await callDcMethodAsync('chat.getQrCode', gId)
          setQrCode(qrCode)
          setViewMode('createVerifiedGroup-showQrCode')