add Last Name placeholder for quoting
[claws.git] / src / quote_fmt_parse.y
index c8d97aae82793b96a7b67548c67a9758f87bbaaa..59b8d04064dc50c7163138210927dc5442c06f49 100644 (file)
@@ -131,7 +131,7 @@ static int isseparator(char ch)
 }
 
 %token SHOW_NEWSGROUPS
-%token SHOW_DATE SHOW_FROM SHOW_FULLNAME SHOW_FIRST_NAME
+%token SHOW_DATE SHOW_FROM SHOW_FULLNAME SHOW_FIRST_NAME SHOW_LAST_NAME
 %token SHOW_SENDER_INITIAL SHOW_SUBJECT SHOW_TO SHOW_MESSAGEID
 %token SHOW_PERCENT SHOW_CC SHOW_REFERENCES SHOW_MESSAGE
 %token SHOW_QUOTED_MESSAGE SHOW_BACKSLASH SHOW_TAB
@@ -222,6 +222,37 @@ special:
                        }
                }
        }
+       | SHOW_LAST_NAME
+        {
+                /* This probably won't work together very well with Middle
+                 names and the like - thth */
+               if (msginfo->fromname) {
+                       gchar *p;
+                       gchar *str;
+
+                       str = alloca(strlen(msginfo->fromname) + 1);
+                       if (str != NULL) {
+                               strcpy(str, msginfo->fromname);
+                                p = str;
+                                while (*p && !isspace(*p)) p++;
+                                if (*p) {
+                                   /* We found a space. Get first none-space char and
+                                    insert rest of string from there. */
+                                   while (*p && isspace(*p)) p++;
+                                    if (*p) {
+                                       INSERT(p);
+                                   } else {
+                                       /* If there is no none-space char, just insert
+                                        whole fromname. */
+                                       INSERT(str);
+                                   }
+                               } else {
+                                   /* If there is no space, just insert whole fromname. */
+                                   INSERT(str);
+                               }
+                       }
+               }
+       }
        | SHOW_SENDER_INITIAL
        {
 #define MAX_SENDER_INITIAL 20