diff --git a/doc/user-guide/commands.xml b/doc/user-guide/commands.xml
a
|
b
|
|
1129 | 1129 | |
1130 | 1130 | <bitlbee-setting name="nick_source" type="string" scope="account"> |
1131 | 1131 | <default>handle</default> |
1132 | | <possible-values>handle, full_name, first_name</possible-values> |
| 1132 | <possible-values>handle, full_name, first_name, last_name</possible-values> |
1133 | 1133 | |
1134 | 1134 | <description> |
1135 | 1135 | <para> |
diff --git a/doc/user-guide/help.txt b/doc/user-guide/help.txt
index 4822e01..5fe2c3f 100644
a
|
b
|
See help nick_format for more information. |
832 | 832 | Type: string |
833 | 833 | Scope: account |
834 | 834 | Default: handle |
835 | | Possible Values: handle, full_name, first_name |
| 835 | Possible Values: handle, full_name, first_name, last_name |
836 | 836 | |
837 | 837 | By default, BitlBee generates a nickname for every contact by taking its handle and chopping off everything after the @. In some cases, this gives very inconvenient nicknames. The Facebook XMPP server is a good example, as all Facebook XMPP handles are numeric. |
838 | 838 | |
839 | | With this setting set to full_name, the person's full name is used to generate a nickname. Or if you don't like long nicknames, set this setting to first_name instead and only the first word will be used. Note that the full name can be full of non-ASCII characters which will be stripped off. |
| 839 | With this setting set to full_name, the person's full name is used to generate a nickname. Or if you don't like long nicknames, set this setting to first_name or last_name instead and only the first or last word will be used. Note that the full name can be full of non-ASCII characters which will be stripped off. |
840 | 840 | % |
841 | 841 | ?set oauth |
842 | 842 | Type: boolean |
… |
… |
The setting is basically some kind of format string. It can contain normal text |
1286 | 1286 | %handle - The handle/screenname of the contact. |
1287 | 1287 | %full_name - The full name of the contact. |
1288 | 1288 | %first_name - The first name of the contact (the full name up to the first space). |
| 1289 | %last_name - The last name of the contact (the full name from the last space). |
1289 | 1290 | %group - The name of the group this contact is a member of |
1290 | 1291 | %account - Account tag of the contact |
1291 | 1292 | |
diff --git a/doc/user-guide/misc.xml b/doc/user-guide/misc.xml
index ac2734c..12b0369 100644
a
|
b
|
text that will be copied to the nick, combined with several variables: |
233 | 233 | <varlistentry><term>%handle</term><listitem><para>The handle/screenname of the contact.</para></listitem></varlistentry> |
234 | 234 | <varlistentry><term>%full_name</term><listitem><para>The full name of the contact.</para></listitem></varlistentry> |
235 | 235 | <varlistentry><term>%first_name</term><listitem><para>The first name of the contact (the full name up to the first space).</para></listitem></varlistentry> |
| 236 | <varlistentry><term>%last_name</term><listitem><para>The last name of the contact (the full name from the last space).</para></listitem></varlistentry> |
236 | 237 | <varlistentry><term>%group</term><listitem><para>The name of the group this contact is a member of</para></listitem></varlistentry> |
237 | 238 | <varlistentry><term>%account</term><listitem><para>Account tag of the contact</para></listitem></varlistentry> |
238 | 239 | </variablelist> |
diff --git a/nick.c b/nick.c
index 4b7e71d..de18411 100644
a
|
b
|
char *nick_gen( bee_user_t *bu ) |
175 | 175 | chop = ' '; |
176 | 176 | break; |
177 | 177 | } |
| 178 | else if( g_strncasecmp( fmt, "last_name", 9 ) == 0 ) |
| 179 | { |
| 180 | char **parts = g_strsplit(bu->fullname, " ", 2); |
| 181 | ssize_t len = g_strv_length(parts); |
| 182 | part = len >= 2 ? g_strdup(parts[len - 1]) : bu->handle; |
| 183 | g_strfreev(parts); |
| 184 | |
| 185 | fmt += 9; |
| 186 | ok |= part && *part; |
| 187 | break; |
| 188 | } |
178 | 189 | else if( g_strncasecmp( fmt, "group", 5 ) == 0 ) |
179 | 190 | { |
180 | 191 | part = bu->group ? bu->group->name : NULL; |