Index: doc/user-guide/misc.xml
===================================================================
--- doc/user-guide/misc.xml (revision 13fa2db53edbeae0d4638db1de042b8f415f8871)
+++ doc/user-guide/misc.xml (revision 3b3c50d9c6709c56c34bbbf9d94717485e2eb04b)
@@ -201,4 +201,5 @@
%first_nameThe first name of the contact (the full name up to the first space).
%groupThe name of the group this contact is a member of
+ %accountAccount tag of the contact
Index: nick.c
===================================================================
--- nick.c (revision 13fa2db53edbeae0d4638db1de042b8f415f8871)
+++ nick.c (revision 3b3c50d9c6709c56c34bbbf9d94717485e2eb04b)
@@ -177,4 +177,10 @@
part = bu->group ? bu->group->name : NULL;
fmt += 5;
+ break;
+ }
+ else if( g_strncasecmp( fmt, "account", 7 ) == 0 )
+ {
+ part = bu->ic->acc->tag;
+ fmt += 7;
break;
}
Index: protocols/account.c
===================================================================
--- protocols/account.c (revision 13fa2db53edbeae0d4638db1de042b8f415f8871)
+++ protocols/account.c (revision 3b3c50d9c6709c56c34bbbf9d94717485e2eb04b)
@@ -73,18 +73,33 @@
set_setstr( &a->set, "username", user );
- if( account_by_tag( bee, prpl->name ) )
- {
+ /* Hardcode some more clever tag guesses. */
+ strcpy( tag, prpl->name );
+ if( strcmp( prpl->name, "oscar" ) == 0 )
+ {
+ if( isdigit( a->user[0] ) )
+ strcpy( tag, "icq" );
+ else
+ strcpy( tag, "aim" );
+ }
+ else if( strcmp( prpl->name, "jabber" ) == 0 )
+ {
+ if( strstr( a->user, "@gmail.com" ) ||
+ strstr( a->user, "@googlemail.com" ) )
+ strcpy( tag, "gtalk" );
+ else if( strstr( a->user, "@chat.facebook.com" ) )
+ strcpy( tag, "fb" );
+ }
+
+ if( account_by_tag( bee, tag ) )
+ {
+ char *numpos = tag + strlen( tag );
int i;
for( i = 2; i < 10000; i ++ )
{
- sprintf( tag, "%s%d", prpl->name, i );
+ sprintf( numpos, "%d", i );
if( !account_by_tag( bee, tag ) )
break;
}
- }
- else
- {
- strcpy( tag, prpl->name );
}
set_setstr( &a->set, "tag", tag );