Changeset 367:7a3e51056fb3

Show
Ignore:
Timestamp:
1998-08-22 06:35:23 (10 years ago)
Author:
Thomas Roessler <roessler@…>
Branch:
mutt-0-94
Message:

[patch-0.94.3.bl.imap_buffy.1] Adding Brandon's IMAP buffy
support.

Files:
1 added
11 modified

Legend:

Unmodified
Added
Removed
  • BUGS

    r364 r367  
    3939  matching nametemplates exist. 
    4040 
     41- mutt_gen_msgid() should _always_ rely on the real FQDN, 
     42  regardless of the hidden_domain feature. 
  • browser.c

    r365 r367  
    157157  struct passwd *pw; 
    158158  struct group *gr; 
    159   
     159 
    160160  switch (op) 
    161161  { 
    162162    case 'd': 
    163       tnow = time (NULL); 
    164       t_fmt = tnow - folder->f->st_mtime < 31536000 ? "%b %d %H:%M" : "%b %d  %Y"; 
    165       strftime (date, sizeof (date), t_fmt, localtime (&folder->f->st_mtime)); 
    166       snprintf (tmp, sizeof (tmp), "%%%ss", fmt); 
    167       snprintf (dest, destlen, tmp, date); 
     163      if (folder->f != NULL) 
     164      { 
     165        tnow = time (NULL); 
     166        t_fmt = tnow - folder->f->st_mtime < 31536000 ? "%b %d %H:%M" : "%b %d  %Y"; 
     167        strftime (date, sizeof (date), t_fmt, localtime (&folder->f->st_mtime)); 
     168        snprintf (tmp, sizeof (tmp), "%%%ss", fmt); 
     169        snprintf (dest, destlen, tmp, date); 
     170      } 
     171      else 
     172      { 
     173        snprintf (tmp, sizeof (tmp), "%%%ss", fmt); 
     174        snprintf (dest, destlen, tmp, ""); 
     175      } 
    168176      break; 
    169177    case 'f': 
    170178      strncpy (fn, folder->name, sizeof(fn) - 1); 
    171       strcat (fn, S_ISLNK (folder->f->st_mode) ? "@" :  
    172               (S_ISDIR (folder->f->st_mode) ? "/" :  
    173                ((folder->f->st_mode & S_IXUSR) != 0 ? "*" : ""))); 
     179      if (folder->f != NULL) 
     180      { 
     181        strcat (fn, S_ISLNK (folder->f->st_mode) ? "@" :  
     182                (S_ISDIR (folder->f->st_mode) ? "/" :  
     183                 ((folder->f->st_mode & S_IXUSR) != 0 ? "*" : ""))); 
     184      } 
    174185      snprintf (tmp, sizeof (tmp), "%%%ss", fmt); 
    175186      snprintf (dest, destlen, tmp, fn); 
    176187      break; 
    177188    case 'F': 
    178       sprintf (permission, "%c%c%c%c%c%c%c%c%c%c", 
    179                S_ISDIR(folder->f->st_mode) ? 'd' : (S_ISLNK(folder->f->st_mode) ? 'l' : '-'), 
    180                (folder->f->st_mode & S_IRUSR) != 0 ? 'r': '-', 
    181                (folder->f->st_mode & S_IWUSR) != 0 ? 'w' : '-', 
    182                (folder->f->st_mode & S_ISUID) != 0 ? 's' : (folder->f->st_mode & S_IXUSR) != 0 ? 'x': '-', 
    183                (folder->f->st_mode & S_IRGRP) != 0 ? 'r' : '-', 
    184                (folder->f->st_mode & S_IWGRP) != 0 ? 'w' : '-', 
    185                (folder->f->st_mode & S_ISGID) != 0 ? 's' : (folder->f->st_mode & S_IXGRP) != 0 ? 'x': '-', 
    186                (folder->f->st_mode & S_IROTH) != 0 ? 'r' : '-', 
    187                (folder->f->st_mode & S_IWOTH) != 0 ? 'w' : '-', 
    188                (folder->f->st_mode & S_ISVTX) != 0 ? 't' : (folder->f->st_mode & S_IXOTH) != 0 ? 'x': '-'); 
    189       snprintf (tmp, sizeof (tmp), "%%%ss", fmt); 
    190       snprintf (dest, destlen, tmp, permission); 
     189      if (folder->f != NULL) 
     190      { 
     191        sprintf (permission, "%c%c%c%c%c%c%c%c%c%c", 
     192                 S_ISDIR(folder->f->st_mode) ? 'd' : (S_ISLNK(folder->f->st_mode) ? 'l' : '-'), 
     193                 (folder->f->st_mode & S_IRUSR) != 0 ? 'r': '-', 
     194                 (folder->f->st_mode & S_IWUSR) != 0 ? 'w' : '-', 
     195                 (folder->f->st_mode & S_ISUID) != 0 ? 's' : (folder->f->st_mode & S_IXUSR) != 0 ? 'x': '-', 
     196                 (folder->f->st_mode & S_IRGRP) != 0 ? 'r' : '-', 
     197                 (folder->f->st_mode & S_IWGRP) != 0 ? 'w' : '-', 
     198                 (folder->f->st_mode & S_ISGID) != 0 ? 's' : (folder->f->st_mode & S_IXGRP) != 0 ? 'x': '-', 
     199                 (folder->f->st_mode & S_IROTH) != 0 ? 'r' : '-', 
     200                 (folder->f->st_mode & S_IWOTH) != 0 ? 'w' : '-', 
     201                 (folder->f->st_mode & S_ISVTX) != 0 ? 't' : (folder->f->st_mode & S_IXOTH) != 0 ? 'x': '-'); 
     202        snprintf (tmp, sizeof (tmp), "%%%ss", fmt); 
     203        snprintf (dest, destlen, tmp, permission); 
     204      } 
     205      else 
     206      { 
     207#ifdef USE_IMAP 
     208        if (strchr(folder->name, '{')) 
     209        { 
     210          snprintf (tmp, sizeof (tmp), "%%%ss", fmt); 
     211          snprintf (dest, destlen, tmp, "IMAP"); 
     212        }                                         
     213#endif 
     214      } 
    191215      break; 
    192216    case 'g': 
    193       if ((gr = getgrgid (folder->f->st_gid))) 
     217      if (folder->f != NULL) 
     218      { 
     219        if ((gr = getgrgid (folder->f->st_gid))) 
     220        { 
     221          snprintf (tmp, sizeof (tmp), "%%%ss", fmt); 
     222          snprintf (dest, destlen, tmp, gr->gr_name); 
     223        } 
     224        else 
     225        { 
     226          snprintf (tmp, sizeof (tmp), "%%%sld", fmt); 
     227          snprintf (dest, destlen, tmp, folder->f->st_gid); 
     228        } 
     229      } 
     230      else 
    194231      { 
    195232        snprintf (tmp, sizeof (tmp), "%%%ss", fmt); 
    196         snprintf (dest, destlen, tmp, gr->gr_name); 
     233        snprintf (dest, destlen, tmp, ""); 
     234      } 
     235      break; 
     236    case 'l': 
     237      if (folder->f != NULL) 
     238      { 
     239        snprintf (tmp, sizeof (tmp), "%%%sd", fmt); 
     240        snprintf (dest, destlen, tmp, folder->f->st_nlink); 
    197241      } 
    198242      else 
    199243      { 
    200         snprintf (tmp, sizeof (tmp), "%%%sld", fmt); 
    201         snprintf (dest, destlen, tmp, folder->f->st_gid); 
    202       } 
    203       break; 
    204     case 'l': 
    205       snprintf (tmp, sizeof (tmp), "%%%sd", fmt); 
    206       snprintf (dest, destlen, tmp, folder->f->st_nlink); 
     244        snprintf (tmp, sizeof (tmp), "%%%ss", fmt); 
     245        snprintf (dest, destlen, tmp, ""); 
     246      } 
    207247      break; 
    208248    case 'N': 
     
    211251      break; 
    212252    case 's': 
    213       snprintf (tmp, sizeof (tmp), "%%%sld", fmt); 
    214       snprintf (dest, destlen, tmp, (long) folder->f->st_size); 
     253      if (folder->f != NULL) 
     254      { 
     255        snprintf (tmp, sizeof (tmp), "%%%sld", fmt); 
     256        snprintf (dest, destlen, tmp, (long) folder->f->st_size); 
     257      } 
     258      else 
     259      { 
     260        snprintf (tmp, sizeof (tmp), "%%%ss", fmt); 
     261        snprintf (dest, destlen, tmp, ""); 
     262      } 
    215263      break; 
    216264    case 'u': 
    217       if ((pw = getpwuid (folder->f->st_uid))) 
     265      if (folder->f != NULL) 
     266      { 
     267        if ((pw = getpwuid (folder->f->st_uid))) 
     268        { 
     269          snprintf (tmp, sizeof (tmp), "%%%ss", fmt); 
     270          snprintf (dest, destlen, tmp, pw->pw_name); 
     271        } 
     272        else 
     273        { 
     274          snprintf (tmp, sizeof (tmp), "%%%sld", fmt); 
     275          snprintf (dest, destlen, tmp, folder->f->st_uid); 
     276        } 
     277      } 
     278      else 
    218279      { 
    219280        snprintf (tmp, sizeof (tmp), "%%%ss", fmt); 
    220         snprintf (dest, destlen, tmp, pw->pw_name); 
    221       } 
    222       else 
    223       { 
    224         snprintf (tmp, sizeof (tmp), "%%%sld", fmt); 
    225         snprintf (dest, destlen, tmp, folder->f->st_uid); 
     281        snprintf (dest, destlen, tmp, ""); 
    226282      } 
    227283      break; 
     
    251307  } 
    252308 
     309  if (s != NULL) 
     310  { 
    253311  (state->entry)[state->entrylen].mode = s->st_mode; 
    254312  (state->entry)[state->entrylen].mtime = s->st_mtime; 
    255313  (state->entry)[state->entrylen].size = s->st_size; 
     314  } 
    256315  (state->entry)[state->entrylen].name = safe_strdup (name); 
    257316  (state->entry)[state->entrylen].desc = safe_strdup (buffer); 
     
    342401  do 
    343402  { 
     403#ifdef USE_IMAP 
     404    if (tmp->path[0] == '{') 
     405    { 
     406      add_folder (menu, state, tmp->path, NULL, tmp->new); 
     407      continue; 
     408    } 
     409#endif 
    344410    if (lstat (tmp->path, &s) == -1) 
    345411      continue; 
  • buffy.c

    r101 r367  
    2121#include "mx.h" 
    2222#include "mailbox.h" 
     23#ifdef USE_IMAP 
     24#include "imap.h" 
     25#endif 
    2326 
    2427#include <string.h> 
     
    243246    tmp->new = 0; 
    244247 
     248#ifdef USE_IMAP 
     249    if ((tmp->magic == M_IMAP) || mx_is_imap (tmp->path)) 
     250    { 
     251      tmp->magic = M_IMAP; 
     252    } 
     253    else 
     254#endif 
    245255    if (stat (tmp->path, &sb) != 0 || 
    246256        (!tmp->magic && (tmp->magic = mx_get_magic (tmp->path)) <= 0)) 
     
    317327        } 
    318328        break; 
     329 
     330#ifdef USE_IMAP 
     331      case M_IMAP: 
     332        if (imap_buffy_check (tmp->path) > 0) 
     333        { 
     334          BuffyCount++; 
     335          tmp->new = 1; 
     336        } 
     337        break; 
     338#endif 
    319339      } 
    320340    } 
  • configure

    r323 r367  
    29402940fi 
    29412941 
    2942         LIBOBJS="$LIBOBJS imap.o" 
     2942        LIBOBJS="$LIBOBJS imap.o socket.o" 
    29432943 
    29442944fi 
  • configure.in

    r323 r367  
    393393        AC_CHECK_LIB(socket, socket) 
    394394        AC_CHECK_LIB(nsl, gethostbyname) 
    395         LIBOBJS="$LIBOBJS imap.o" 
     395        LIBOBJS="$LIBOBJS imap.o socket.o" 
    396396]) 
    397397 
  • curs_lib.c

    r348 r367  
    179179  va_end (ap); 
    180180   
     181  dprint (1, (debugfile, "%s\n", Errorbuf)); 
    181182  Errorbuf[ (COLS < sizeof (Errorbuf) ? COLS : sizeof (Errorbuf)) - 2 ] = 0; 
    182183 
     
    233234  char *p = strerror (errno); 
    234235 
     236  dprint (1, (debugfile, "%s: %s (errno = %d)\n", s,  
     237      p ? p : "unknown error", errno)); 
    235238  mutt_error ("%s: %s (errno = %d)", s, p ? p : "unknown error", errno); 
    236239} 
  • imap.c

    r346 r367  
    2222#include "mailbox.h" 
    2323#include "globals.h" 
     24#include "mutt_socket.h" 
    2425 
    2526#include <unistd.h> 
     
    4849  IMAP_EXPUNGE, 
    4950  IMAP_BYE, 
    50   IMAP_OK_FAIL, 
    51   IMAP_OPEN_NEW 
     51  IMAP_OK_FAIL 
    5252}; 
    5353 
    5454typedef struct 
    5555{ 
    56   char *server; 
    57   int uses; 
    58   int fd; 
    59   char inbuf[LONG_STRING]; 
    60   int bufpos; 
    61   int available; 
    62 } CONNECTION; 
    63  
    64 typedef struct 
    65 { 
    66   int index; 
     56  unsigned int index; 
    6757  char *path; 
    6858} IMAP_CACHE; 
     
    7161{ 
    7262  short status; 
    73   unsigned short sequence; 
    7463  unsigned short newMailCount; 
    7564  char *mailbox; 
     
    8170#define CTX_DATA ((IMAP_DATA *) ctx->data) 
    8271 
    83 static CONNECTION *Connections = NULL; 
    84 static int NumConnections = 0; 
    85  
    8672/* Linked list to hold header information while downloading message 
    8773 * headers 
     
    10187} IMAP_HEADER_INFO; 
    10288 
    103 /* simple read buffering to speed things up. */ 
    104 static int imap_readchar (CONNECTION *conn, char *c) 
    105 { 
    106   if (conn->bufpos >= conn->available) 
    107   { 
    108     conn->available = read (conn->fd, conn->inbuf,  
    109                             sizeof(LONG_STRING) > SSIZE_MAX ? SSIZE_MAX : sizeof(LONG_STRING)); 
    110     conn->bufpos = 0; 
    111     if (conn->available <= 0) 
    112       return conn->available; /* returns 0 for EOF or -1 for other error */ 
    113   } 
    114   *c = conn->inbuf[conn->bufpos]; 
    115   conn->bufpos++; 
    116   return 1; 
    117 } 
    118  
    119 static int imap_read_line (char *buf, size_t buflen, CONNECTION *conn) 
    120 { 
    121   char ch; 
    122   int i; 
    123  
    124   for (i = 0; i < buflen; i++) 
    125   { 
    126     if (imap_readchar (conn, &ch) != 1) 
    127       return (-1); 
    128     if (ch == '\n') 
    129       break; 
    130     buf[i] = ch; 
    131   } 
    132   buf[i-1] = 0; 
    133   return (i + 1); 
    134 } 
    135  
    136 static int imap_read_line_d (char *buf, size_t buflen, CONNECTION *conn) 
    137 { 
    138   int r = imap_read_line (buf, buflen, conn); 
    139   dprint (1,(debugfile,"imap_read_line_d():%s\n", buf)); 
    140   return r; 
    141 } 
    142  
    143 static void imap_make_sequence (char *buf, size_t buflen, CONTEXT *ctx) 
    144 { 
    145   snprintf (buf, buflen, "a%04d", CTX_DATA->sequence++); 
    146 } 
    147  
    148 static int imap_write (CONNECTION *conn, const char *buf) 
    149 { 
    150   dprint (1,(debugfile,"imap_write():%s", buf)); 
    151   return (write (conn->fd, buf, strlen (buf))); 
    152 } 
     89 
     90static void imap_make_sequence (char *buf, size_t buflen) 
     91{ 
     92  static int sequence = 0; 
     93   
     94  snprintf (buf, buflen, "a%04d", sequence++); 
     95} 
     96 
    15397 
    15498static void imap_error (const char *where, const char *msg) 
    15599{ 
    156100  mutt_error ("imap_error(): unexpected response in %s: %s\n", where, msg); 
    157 } 
    158  
    159 static CONNECTION *imap_select_connection (char *host, int flags) 
    160 { 
    161   int x; 
    162  
    163   if (flags != IMAP_OPEN_NEW) 
    164   { 
    165     for (x = 0; x < NumConnections; x++) 
    166     { 
    167       if (!strcmp (host, Connections[x].server)) 
    168         return &Connections[x]; 
    169     } 
    170   } 
    171   if (NumConnections == 0) 
    172   { 
    173     NumConnections = 1; 
    174     Connections = (CONNECTION *) safe_malloc (sizeof (CONNECTION)); 
    175   } 
    176   else 
    177   { 
    178     NumConnections++; 
    179     safe_realloc ((void *)&Connections, sizeof (CONNECTION) * NumConnections); 
    180   } 
    181   Connections[NumConnections - 1].bufpos = 0; 
    182   Connections[NumConnections - 1].available = 0; 
    183   Connections[NumConnections - 1].uses = 0; 
    184   Connections[NumConnections - 1].server = safe_strdup (host); 
    185  
    186   return &Connections[NumConnections - 1]; 
    187101} 
    188102 
     
    353267  for (pos = 0; pos < bytes; ) 
    354268  { 
    355     len = imap_read_line (buf, sizeof (buf), conn); 
     269    len = mutt_socket_read_line (buf, sizeof (buf), conn); 
    356270    if (len < 0) 
    357271      return (-1); 
     
    485399    if (msgno + 1 > fetchlast) 
    486400    { 
    487       imap_make_sequence (seq, sizeof (seq), ctx); 
     401      imap_make_sequence (seq, sizeof (seq)); 
    488402      /* 
    489403       * Make one request for everything. This makes fetching headers an 
     
    494408       */ 
    495409      snprintf (buf, sizeof (buf), "%s FETCH %d:%d (FLAGS INTERNALDATE RFC822.SIZE BODY.PEEK[HEADER.FIELDS (DATE FROM SUBJECT TO CC MESSAGE-ID REFERENCES CONTENT-TYPE IN-REPLY-TO REPLY-TO)])\r\n", seq, msgno + 1, msgend + 1); 
    496       imap_write (CTX_DATA->conn, buf); 
     410      mutt_socket_write (CTX_DATA->conn, buf); 
    497411      fetchlast = msgend + 1; 
    498412    } 
     
    500414    do 
    501415    { 
    502       if (imap_read_line_d (buf, sizeof (buf), CTX_DATA->conn) < 0) 
     416      if (mutt_socket_read_line_d (buf, sizeof (buf), CTX_DATA->conn) < 0) 
    503417      { 
    504418        return (-1); 
     
    540454 
    541455            imap_read_bytes (fp, CTX_DATA->conn, bytes); 
    542             if (imap_read_line_d (buf, sizeof (buf), CTX_DATA->conn) < 0) 
     456            if (mutt_socket_read_line_d (buf, sizeof (buf), CTX_DATA->conn) < 0) 
    543457            { 
    544458              return (-1); 
     
    614528  int count; 
    615529 
    616   imap_write (CTX_DATA->conn, cmd); 
     530  mutt_socket_write (CTX_DATA->conn, cmd); 
    617531 
    618532  do 
    619533  { 
    620     if (imap_read_line_d (buf, buflen, CTX_DATA->conn) < 0) 
     534    if (mutt_socket_read_line_d (buf, buflen, CTX_DATA->conn) < 0) 
    621535      return (-1); 
    622536 
     
    658572  } 
    659573 
     574  return 0; 
     575} 
     576 
     577static int imap_parse_path (char *path, char *host, size_t hlen, char **mbox) 
     578{ 
     579  int n; 
     580  char *pc; 
     581 
     582  pc = path; 
     583  if (*pc != '{') 
     584    return (-1); 
     585  pc++; 
     586  n = 0; 
     587  while (*pc && *pc != '}' && (n < hlen-1)) 
     588    host[n++] = *pc++; 
     589  host[n] = 0; 
     590  if (!*pc) 
     591    return (-1); 
     592  pc++; 
     593 
     594  *mbox = pc; 
    660595  return 0; 
    661596} 
     
    700635  } 
    701636 
    702   if (imap_read_line_d (buf, sizeof (buf), conn) < 0) 
     637  if (mutt_socket_read_line_d (buf, sizeof (buf), conn) < 0) 
    703638  { 
    704639    close (conn->fd); 
     
    735670 
    736671    mutt_message ("Logging in..."); 
    737     /* sequence numbers are currently context dependent, so just make one 
    738      * up for this first access to the server */ 
    739     strcpy (seq, "l0000"); 
     672    imap_make_sequence (seq, sizeof (seq)); 
    740673    snprintf (buf, sizeof (buf), "%s LOGIN %s %s\r\n", seq, user, pass); 
    741674    if (imap_exec (buf, sizeof (buf), ctx, seq, buf, 0) != 0) 
     
    767700  char host[SHORT_STRING]; 
    768701  char seq[16]; 
     702  char *pc = NULL; 
    769703  int count = 0; 
    770704  int n; 
    771   char *pc; 
    772  
    773   pc = ctx->path; 
    774   if (*pc != '{') 
    775     return (-1); 
    776   pc++; 
    777   n = 0; 
    778   while (*pc && *pc != '}') 
    779     host[n++] = *pc++; 
    780   host[n] = 0; 
    781   if (!*pc) 
    782     return (-1); 
    783   pc++; 
     705 
     706  if (imap_parse_path (ctx->path, host, sizeof (host), &pc)) 
     707    return (-1); 
    784708 
    785709  /* create IMAP-specific state struct */ 
     
    789713  CTX_DATA->mailbox = safe_strdup (pc); 
    790714 
    791   conn = imap_select_connection (host, IMAP_OPEN_NEW); 
     715  conn = mutt_socket_select_connection (host, IMAP_PORT, M_NEW_SOCKET); 
    792716  CTX_DATA->conn = conn; 
    793717 
     
    798722 
    799723  mutt_message ("Selecting %s...", CTX_DATA->mailbox); 
    800   imap_make_sequence (seq, sizeof (seq), ctx); 
     724  imap_make_sequence (seq, sizeof (seq)); 
    801725  snprintf (bufout, sizeof (bufout), "%s SELECT %s\r\n", seq, CTX_DATA->mailbox); 
    802   imap_write (CTX_DATA->conn, bufout); 
     726  mutt_socket_write (CTX_DATA->conn, bufout); 
    803727 
    804728  do 
    805729  { 
    806     if (imap_read_line_d (buf, sizeof (buf), CTX_DATA->conn) < 0) 
     730    if (mutt_socket_read_line_d (buf, sizeof (buf), CTX_DATA->conn) < 0) 
    807731      break; 
    808732 
     
    843767  char buf[LONG_STRING]; 
    844768 
    845   imap_make_sequence (seq, sizeof (seq), ctx); 
     769  imap_make_sequence (seq, sizeof (seq)); 
    846770  snprintf (buf, sizeof (buf), "%s CREATE %s\r\n", seq, CTX_DATA->mailbox); 
    847771       
     
    860784  char buf[LONG_STRING]; 
    861785  char seq[16]; 
    862   int n; 
    863786  char *pc; 
    864787 
    865   pc = ctx->path; 
    866   if (*pc != '{') 
    867     return (-1); 
    868   pc++; 
    869   n = 0; 
    870   while (*pc && *pc != '}') 
    871     host[n++] = *pc++; 
    872   host[n] = 0; 
    873   if (!*pc) 
    874     return (-1); 
    875   pc++; 
     788  if (imap_parse_path (ctx->path, host, sizeof (host), &pc)) 
     789    return (-1); 
    876790 
    877791  /* create IMAP-specific state struct */ 
     
    882796  CTX_DATA->mailbox = pc; 
    883797 
    884   conn = imap_select_connection (host, 0); 
     798  conn = mutt_socket_select_connection (host, IMAP_PORT, 0); 
    885799  CTX_DATA->conn = conn; 
    886800 
     
    892806  /* check mailbox existance */ 
    893807 
    894   imap_make_sequence (seq, sizeof (seq), ctx); 
     808  imap_make_sequence (seq, sizeof (seq)); 
    895809  snprintf (buf, sizeof (buf), "%s STATUS %s (UIDVALIDITY)\r\n", seq,  
    896810      CTX_DATA->mailbox); 
     
    955869  } 
    956870 
    957   imap_make_sequence (seq, sizeof (seq), ctx); 
     871  imap_make_sequence (seq, sizeof (seq)); 
    958872  snprintf (buf, sizeof (buf), "%s FETCH %d RFC822\r\n", seq, 
    959873            ctx->hdrs[msgno]->index + 1); 
    960   imap_write (CTX_DATA->conn, buf); 
     874  mutt_socket_write (CTX_DATA->conn, buf); 
    961875  do 
    962876  { 
    963     if (imap_read_line (buf, sizeof (buf), CTX_DATA->conn) < 0) 
     877    if (mutt_socket_read_line (buf, sizeof (buf), CTX_DATA->conn) < 0) 
    964878    { 
    965879      return (-1); 
     
    986900        for (pos = 0; pos < bytes; ) 
    987901        { 
    988           len = imap_read_line (buf, sizeof (buf), CTX_DATA->conn); 
     902          len = mutt_socket_read_line (buf, sizeof (buf), CTX_DATA->conn); 
    989903          if (len < 0) 
    990904            return (-1); 
     
    1039953 
    1040954  mutt_message ("Sending APPEND command ..."); 
    1041   imap_make_sequence (seq, sizeof (seq), ctx); 
     955  imap_make_sequence (seq, sizeof (seq)); 
    1042956  snprintf (buf, sizeof (buf), "%s APPEND %s {%d}\r\n", seq,  
    1043957      CTX_DATA->mailbox, s.st_size); 
    1044958 
    1045   imap_write (CTX_DATA->conn, buf); 
     959  mutt_socket_write (CTX_DATA->conn, buf); 
    1046960 
    1047961  do  
    1048962  { 
    1049     if (imap_read_line_d (buf, sizeof (buf), CTX_DATA->conn) < 0) 
     963    if (mutt_socket_read_line_d (buf, sizeof (buf), CTX_DATA->conn) < 0) 
    1050964    { 
    1051965      fclose (fp); 
     
    1079993  while (fgets (buf, sizeof (buf), fp) != NULL) 
    1080994  { 
    1081     imap_write (CTX_DATA->conn, buf); 
    1082   } 
    1083   imap_write (CTX_DATA->conn, "\r\n"); 
     995    mutt_socket_write (CTX_DATA->conn, buf); 
     996  } 
     997  mutt_socket_write (CTX_DATA->conn, "\r\n"); 
    1084998  fclose (fp); 
    1085999 
    10861000  do 
    10871001  { 
    1088     if (imap_read_line_d (buf, sizeof (buf), CTX_DATA->conn) < 0) 
     1002    if (mutt_socket_read_line_d (buf, sizeof (buf), CTX_DATA->conn) < 0) 
    1089