LCOV - code coverage report
Current view: top level - libemail/src/infrastructure - help_gmail.h (source / functions) Coverage Total Hit
Test: coverage-functional.info Lines: 0.0 % 3 0
Test Date: 2026-05-07 15:53:08 Functions: 0.0 % 1 0

            Line data    Source code
       1              : #ifndef HELP_GMAIL_H
       2              : #define HELP_GMAIL_H
       3              : 
       4              : #include <stdio.h>
       5              : 
       6              : /**
       7              :  * @file help_gmail.h
       8              :  * @brief Built-in Gmail OAuth2 setup guide, accessible via 'help gmail'.
       9              :  *
      10              :  * Inline header so both email-cli and email-tui can use it without
      11              :  * adding a separate .c file to the build.
      12              :  */
      13              : 
      14            0 : static inline void help_gmail(void) {
      15            0 :     printf(
      16              :         "Gmail OAuth2 Setup Guide\n"
      17              :         "========================\n"
      18              :         "\n"
      19              :         "email-cli uses the Gmail REST API (not IMAP) for Gmail accounts.\n"
      20              :         "You need OAuth2 credentials (client_id and client_secret) from a\n"
      21              :         "Google Cloud project.\n"
      22              :         "\n"
      23              :         "Step 1: Create a Google Cloud Project\n"
      24              :         "  1. Go to https://console.cloud.google.com/\n"
      25              :         "  2. Click 'Select a project' → 'New Project'\n"
      26              :         "  3. Name it (e.g. 'email-cli') → Create\n"
      27              :         "\n"
      28              :         "Step 2: Enable the Gmail API\n"
      29              :         "  1. Go to APIs & Services → Library\n"
      30              :         "  2. Search 'Gmail API' → Enable\n"
      31              :         "\n"
      32              :         "Step 3: Configure OAuth Consent Screen\n"
      33              :         "  1. Go to APIs & Services → OAuth consent screen\n"
      34              :         "  2. Select 'External' → Create\n"
      35              :         "  3. Fill in app name, support email, developer email\n"
      36              :         "  4. Add scope: https://mail.google.com/\n"
      37              :         "  5. Add your Gmail address as a test user\n"
      38              :         "\n"
      39              :         "Step 4: Create Credentials\n"
      40              :         "  1. Go to APIs & Services → Credentials\n"
      41              :         "  2. Create Credentials → OAuth client ID\n"
      42              :         "  3. Application type: 'Desktop app'\n"
      43              :         "  4. Copy the Client ID and Client Secret\n"
      44              :         "\n"
      45              :         "Step 5: Add Account\n"
      46              :         "  Run the setup wizard (press 'n' in email-tui, or run email-cli\n"
      47              :         "  without config). Select account type [2] Gmail. The wizard will\n"
      48              :         "  ask for your Client ID and Client Secret, then guide you through\n"
      49              :         "  the authorization flow.\n"
      50              :         "\n"
      51              :         "  Alternatively, create the config file manually:\n"
      52              :         "    ~/.config/email-cli/accounts/<email>/config.ini\n"
      53              :         "  with:\n"
      54              :         "    GMAIL_MODE=1\n"
      55              :         "    EMAIL_USER=you@gmail.com\n"
      56              :         "    GMAIL_CLIENT_ID=<your-client-id>.apps.googleusercontent.com\n"
      57              :         "    GMAIL_CLIENT_SECRET=<your-client-secret>\n"
      58              :         "\n"
      59              :         "Security notes:\n"
      60              :         "  - client_id/secret identify the app, not the user (not truly secret\n"
      61              :         "    for native apps — this follows Google's own guidelines)\n"
      62              :         "  - refresh_token IS sensitive — stored in config.ini with mode 0600\n"
      63              :         "  - Scope grants full Gmail access (read, send, modify, delete)\n"
      64              :     );
      65            0 : }
      66              : 
      67              : #endif /* HELP_GMAIL_H */
        

Generated by: LCOV version 2.0-1