annotate src/protocols/zephyr/ZGetSender.c @ 13033:69b3d5cbd2b1

[gaim-migrate @ 15389] Kill gaim_date() and gaim_date_full(). The former isn't used and the latter is used only twice. This makes the buddy pounce pop-ups and debug log headers contain localized dates, fixing part of SF Bug #1325915. Thanks to Bleeter for discovering that gaim_date() isn't used. committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Wed, 25 Jan 2006 02:58:54 +0000
parents 1b0c83666f98
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1 /* This file is part of the Project Athena Zephyr Notification System.
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2 * It contains source for the ZGetSender.c function.
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3 *
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4 * Created by: Robert French
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
5 *
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
6 * Copyright (c) 1987, 1991 by the Massachusetts Institute of Technology.
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
7 * For copying and distribution information, see the file
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
8 * "mit-copyright.h".
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
9 */
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
10
8792
43d6c08d7e96 [gaim-migrate @ 9554]
Christian Hammond <chipx86@chipx86.com>
parents: 2086
diff changeset
11 #include "internal.h"
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
12
10867
5727afad0fb8 [gaim-migrate @ 12553]
Mark Doliner <mark@kingant.net>
parents: 10038
diff changeset
13 #ifndef WIN32
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
14 #include <pwd.h>
10867
5727afad0fb8 [gaim-migrate @ 12553]
Mark Doliner <mark@kingant.net>
parents: 10038
diff changeset
15 #endif
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
16
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
17 char *ZGetSender()
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
18 {
11933
1b0c83666f98 [gaim-migrate @ 14224]
Richard Laager <rlaager@wiktel.com>
parents: 11932
diff changeset
19 struct passwd *pw;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
20 #ifdef ZEPHYR_USES_KERBEROS
11933
1b0c83666f98 [gaim-migrate @ 14224]
Richard Laager <rlaager@wiktel.com>
parents: 11932
diff changeset
21 char pname[ANAME_SZ];
1b0c83666f98 [gaim-migrate @ 14224]
Richard Laager <rlaager@wiktel.com>
parents: 11932
diff changeset
22 char pinst[INST_SZ];
1b0c83666f98 [gaim-migrate @ 14224]
Richard Laager <rlaager@wiktel.com>
parents: 11932
diff changeset
23 char prealm[REALM_SZ];
1b0c83666f98 [gaim-migrate @ 14224]
Richard Laager <rlaager@wiktel.com>
parents: 11932
diff changeset
24 static char sender[ANAME_SZ+INST_SZ+REALM_SZ+3] = "";
10867
5727afad0fb8 [gaim-migrate @ 12553]
Mark Doliner <mark@kingant.net>
parents: 10038
diff changeset
25 long int kerror;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
26 #else
11933
1b0c83666f98 [gaim-migrate @ 14224]
Richard Laager <rlaager@wiktel.com>
parents: 11932
diff changeset
27 static char sender[128] = "";
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
28 #endif
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
29
10867
5727afad0fb8 [gaim-migrate @ 12553]
Mark Doliner <mark@kingant.net>
parents: 10038
diff changeset
30 #ifdef WIN32
11933
1b0c83666f98 [gaim-migrate @ 14224]
Richard Laager <rlaager@wiktel.com>
parents: 11932
diff changeset
31 unsigned long sender_size = sizeof(sender) - 1;
10867
5727afad0fb8 [gaim-migrate @ 12553]
Mark Doliner <mark@kingant.net>
parents: 10038
diff changeset
32 #endif
5727afad0fb8 [gaim-migrate @ 12553]
Mark Doliner <mark@kingant.net>
parents: 10038
diff changeset
33
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
34 #ifdef ZEPHYR_USES_KERBEROS
10867
5727afad0fb8 [gaim-migrate @ 12553]
Mark Doliner <mark@kingant.net>
parents: 10038
diff changeset
35 if ((kerror = krb_get_tf_fullname((char *)TKT_FILE, pname, pinst, prealm)) == KSUCCESS)
11933
1b0c83666f98 [gaim-migrate @ 14224]
Richard Laager <rlaager@wiktel.com>
parents: 11932
diff changeset
36 {
1b0c83666f98 [gaim-migrate @ 14224]
Richard Laager <rlaager@wiktel.com>
parents: 11932
diff changeset
37 sprintf(sender, "%s%s%s@%s", pname, (pinst[0] ? "." : ""), pinst, prealm);
1b0c83666f98 [gaim-migrate @ 14224]
Richard Laager <rlaager@wiktel.com>
parents: 11932
diff changeset
38 return sender;
1b0c83666f98 [gaim-migrate @ 14224]
Richard Laager <rlaager@wiktel.com>
parents: 11932
diff changeset
39 }
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
40 #endif
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
41
10867
5727afad0fb8 [gaim-migrate @ 12553]
Mark Doliner <mark@kingant.net>
parents: 10038
diff changeset
42 #ifdef WIN32
11933
1b0c83666f98 [gaim-migrate @ 14224]
Richard Laager <rlaager@wiktel.com>
parents: 11932
diff changeset
43 GetUserName(sender, &sender_size);
10867
5727afad0fb8 [gaim-migrate @ 12553]
Mark Doliner <mark@kingant.net>
parents: 10038
diff changeset
44 #else
11933
1b0c83666f98 [gaim-migrate @ 14224]
Richard Laager <rlaager@wiktel.com>
parents: 11932
diff changeset
45 /* XXX a uid_t is a u_short (now), but getpwuid
1b0c83666f98 [gaim-migrate @ 14224]
Richard Laager <rlaager@wiktel.com>
parents: 11932
diff changeset
46 * wants an int. AARGH! */
1b0c83666f98 [gaim-migrate @ 14224]
Richard Laager <rlaager@wiktel.com>
parents: 11932
diff changeset
47 pw = getpwuid((int) getuid());
1b0c83666f98 [gaim-migrate @ 14224]
Richard Laager <rlaager@wiktel.com>
parents: 11932
diff changeset
48 if (!pw)
1b0c83666f98 [gaim-migrate @ 14224]
Richard Laager <rlaager@wiktel.com>
parents: 11932
diff changeset
49 return ("unknown");
1b0c83666f98 [gaim-migrate @ 14224]
Richard Laager <rlaager@wiktel.com>
parents: 11932
diff changeset
50 sprintf(sender, "%s@%s", pw->pw_name, __Zephyr_realm);
10867
5727afad0fb8 [gaim-migrate @ 12553]
Mark Doliner <mark@kingant.net>
parents: 10038
diff changeset
51 #endif
11933
1b0c83666f98 [gaim-migrate @ 14224]
Richard Laager <rlaager@wiktel.com>
parents: 11932
diff changeset
52 return sender;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
53 }