Mercurial > ~mikael > mcabber > hg
comparison mcabber/src/hooks.c @ 1188:ef40688d87bd
Add option 'buddy_me_fulljid'
When a contacts sends "/me ", mcabber used to display "*user@server.net ",
which can take a lot of space. It now displays only "*user ", but the old
behaviour can be kept with the new option.
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Fri, 20 Apr 2007 18:02:38 +0200 |
parents | 9726c78a91f3 |
children | e802ec0c02d2 |
comparison
equal
deleted
inserted
replaced
1187:16abe7ec3056 | 1188:ef40688d87bd |
---|---|
65 if (!strncmp(msg, COMMAND_ME, strlen(COMMAND_ME))) | 65 if (!strncmp(msg, COMMAND_ME, strlen(COMMAND_ME))) |
66 wmsg = mmsg = g_strdup_printf("*%s %s", resname, msg+4); | 66 wmsg = mmsg = g_strdup_printf("*%s %s", resname, msg+4); |
67 } | 67 } |
68 } else { | 68 } else { |
69 bmsg = g_strdup(msg); | 69 bmsg = g_strdup(msg); |
70 if (!strncmp(msg, COMMAND_ME, strlen(COMMAND_ME))) | 70 if (!strncmp(msg, COMMAND_ME, strlen(COMMAND_ME))) { |
71 wmsg = mmsg = g_strdup_printf("*%s %s", bjid, msg+4); | 71 gchar *shortid = g_strdup(bjid); |
72 else | 72 if (settings_opt_get_int("buddy_me_fulljid") == FALSE) { |
73 gchar *p = strchr(shortid, '@'); // Truncate the jid | |
74 if (p) | |
75 *p = '\0'; | |
76 } | |
77 wmsg = mmsg = g_strdup_printf("*%s %s", shortid, msg+4); | |
78 g_free(shortid); | |
79 } else | |
73 wmsg = (char*) msg; | 80 wmsg = (char*) msg; |
74 } | 81 } |
75 | 82 |
76 // If this user isn't in the roster, we add it | 83 // If this user isn't in the roster, we add it |
77 roster_usr = roster_find(bjid, jidsearch, 0); | 84 roster_usr = roster_find(bjid, jidsearch, 0); |