Ticket #3245: mutt_mbox_alias.4.patch
| File mutt_mbox_alias.4.patch, 6.1 KB (added by tamentis, 4 years ago) |
|---|
-
doc/manual.xml.head
diff -r d213f3acdb68 doc/manual.xml.head
a b 4355 4355 4356 4356 </sect1> 4357 4357 4358 <sect1 id="mbalias"> 4359 <title>Mailbox Aliases</title> 4360 4361 <para>Usage:</para> 4362 4363 <cmdsynopsis> 4364 <command>mbalias</command> 4365 <arg choice="plain"> 4366 <replaceable class="parameter">name</replaceable> 4367 </arg> 4368 <arg choice="plain"> 4369 <replaceable class="parameter">path</replaceable> 4370 </arg> 4371 </cmdsynopsis> 4372 4373 <para> 4374 This command will let you define aliases for your mailboxes. This is 4375 typically used with IMAP or POP mailboxes with longer path/URLs but it 4376 can be used for any other path. Within Mutt you can use the '*' prefix 4377 to use and access your alias like any other path. Here is an example with 4378 <command>mailboxes</command>: 4379 <screen> 4380 mbalias work imaps://user@imap.bigcompany.com/projects/x/inbox 4381 mailboxes *work</screen> 4382 </para> 4383 4384 </sect1> 4385 4358 4386 </chapter> 4359 4387 4360 4388 <chapter id="advancedusage"> … … 5361 5389 @<emphasis>alias</emphasis> — refers to the <link linkend="save-hook">default save folder</link> as determined by the address of the alias 5362 5390 </para> 5363 5391 </listitem> 5392 <listitem> 5393 5394 <para> 5395 *<emphasis>alias</emphasis> — refers to a <link linkend="mbalias">Mailbox alias</link> 5396 </para> 5397 </listitem> 5364 5398 5365 5399 </itemizedlist> 5366 5400 -
doc/muttrc.man.head
diff -r d213f3acdb68 doc/muttrc.man.head
a b 272 272 and subscribed mailing lists. The \fBunsubscribe\fP command removes 273 273 it from the list of subscribed mailing lists. The \fb-group\fP flag 274 274 adds all of the subsequent regular expressions to the named group. 275 .TP 275 .PP 276 .nf 277 \fBmbalias\fP \fIname\fP \fIpath\fP 278 .fi 279 .IP 280 This command lets you define aliases for your mailboxes. It is used 281 mostly to shorten very long path and URLs such as IMAP or POP accounts but 282 can also be used with any other prefix or path. You can use it within mutt 283 with the '*' prefix. 284 .PP 285 .nf 276 286 \fBmbox-hook\fP [\fB!\fP]\fIpattern\fP \fImailbox\fP 287 .fi 288 .IP 277 289 When mutt changes to a mail folder which matches \fIpattern\fP, 278 290 \fImailbox\fP will be used as the \(lqmbox\(rq folder, i.e., read 279 291 messages will be moved to that folder when the mail folder is left. -
globals.h
diff -r d213f3acdb68 globals.h
a b 220 220 221 221 WHERE ALIAS *Aliases INITVAL (0); 222 222 WHERE LIST *UserHeader INITVAL (0); 223 WHERE MBALIAS *MbAliases INITVAL (0); 223 224 224 225 /*-- formerly in pgp.h --*/ 225 226 WHERE REGEXP PgpGoodSign; -
init.c
diff -r d213f3acdb68 init.c
a b 1388 1388 return -1; 1389 1389 } 1390 1390 1391 static int parse_mbalias (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err) 1392 { 1393 MBALIAS *tmp = MbAliases; 1394 MBALIAS *last = NULL; 1395 BUFFER name, path; 1396 char exp_path[_POSIX_PATH_MAX]; 1397 1398 memset (&name, 0, sizeof (name)); 1399 memset (&path, 0, sizeof (path)); 1400 1401 if (!MoreArgs (s)) 1402 { 1403 strfcpy (err->data, _("too few arguments"), err->dsize); 1404 goto error; 1405 } 1406 1407 mutt_extract_token (&name, s, 0); 1408 1409 if (!buf->data) 1410 { 1411 strfcpy (err->data, _("too few arguments"), err->dsize); 1412 goto error; 1413 } 1414 1415 mutt_extract_token (&path, s, 0); 1416 1417 if (MoreArgs (s)) 1418 { 1419 strfcpy (err->data, _("too many arguments"), err->dsize); 1420 goto error; 1421 } 1422 1423 /* keep the expanded path with the alias */ 1424 strfcpy (exp_path, path.data, sizeof (exp_path)); 1425 mutt_expand_path (exp_path, sizeof (exp_path)); 1426 FREE (&path.data); 1427 1428 /* check to see if an alias with this name already exists */ 1429 for (; tmp; tmp = tmp->next) 1430 { 1431 if (!mutt_strcasecmp (tmp->name, name.data)) 1432 break; 1433 last = tmp; 1434 } 1435 1436 if (!tmp) 1437 { 1438 /* create a new alias */ 1439 tmp = (MBALIAS *) safe_calloc (1, sizeof (MBALIAS)); 1440 tmp->name = safe_strdup (name.data); 1441 FREE (&name.data); 1442 tmp->path = safe_strdup (exp_path); 1443 } 1444 else 1445 { 1446 /* override the previous value */ 1447 mutt_str_replace(&tmp->path, exp_path); 1448 } 1449 1450 1451 if (last) 1452 last->next = tmp; 1453 else 1454 MbAliases = tmp; 1455 1456 return 0; 1457 1458 error: 1459 FREE (&name.data); 1460 FREE (&path.data); 1461 return (-1); 1462 } 1463 1391 1464 static int 1392 1465 parse_unmy_hdr (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err) 1393 1466 { -
init.h
diff -r d213f3acdb68 init.h
a b 3414 3414 static int parse_unlists (BUFFER *, BUFFER *, unsigned long, BUFFER *); 3415 3415 static int parse_alias (BUFFER *, BUFFER *, unsigned long, BUFFER *); 3416 3416 static int parse_unalias (BUFFER *, BUFFER *, unsigned long, BUFFER *); 3417 static int parse_mbalias (BUFFER *, BUFFER *, unsigned long, BUFFER *); 3417 3418 static int parse_ignore (BUFFER *, BUFFER *, unsigned long, BUFFER *); 3418 3419 static int parse_unignore (BUFFER *, BUFFER *, unsigned long, BUFFER *); 3419 3420 static int parse_source (BUFFER *, BUFFER *, unsigned long, BUFFER *); … … 3472 3473 { "macro", mutt_parse_macro, 0 }, 3473 3474 { "mailboxes", mutt_parse_mailboxes, M_MAILBOXES }, 3474 3475 { "unmailboxes", mutt_parse_mailboxes, M_UNMAILBOXES }, 3476 { "mbalias", parse_mbalias, 0 }, 3475 3477 { "message-hook", mutt_parse_hook, M_MESSAGEHOOK }, 3476 3478 { "mbox-hook", mutt_parse_hook, M_MBOXHOOK }, 3477 3479 { "mime_lookup", parse_list, UL &MimeLookupList }, -
mutt.h
diff -r d213f3acdb68 mutt.h
a b 568 568 short num; 569 569 } ALIAS; 570 570 571 typedef struct mbalias 572 { 573 char *name; 574 char *path; 575 struct mbalias *next; 576 } MBALIAS; 577 571 578 typedef struct envelope 572 579 { 573 580 ADDRESS *return_path; -
muttlib.c
diff -r d213f3acdb68 muttlib.c
a b 444 444 } 445 445 } 446 446 break; 447 448 case '*': 449 { 450 MBALIAS *alias = MbAliases; 451 452 tail = s + 1; 453 for (; alias; alias = alias->next) 454 { 455 if (!mutt_strcasecmp (alias->name, s + 1)) { 456 strfcpy (p, alias->path, sizeof (p)); 457 tail = ""; 458 break; 459 } 460 } 461 } 462 break; 447 463 448 464 case '>': 449 465 {