comparison src/protocols/oscar/util.c @ 8982:a4fd6666bb83

[gaim-migrate @ 9757] Some Direct IM fixes. 1. Let's send our correct ip. We were usually sending localhost, so the other side would try to connect to localhost and immediately fail and so say, hey! I can't connect to you! Connect to me instead! 2. Add some gaim_conversation_writes to keep the user more informed as to what's going on. This changes the libfaim API. libfaim users take note. I removed the util get local ip function, and made the function that used to use it take an ip as an argument instead, so that oscar.c could just call gaim's function, which works better. I also made it possible to specify a cookie to use, because I think I'll need that later. Probably. committer: Tailor Script <tailor@pidgin.im>
author Tim Ringenbach <marv@pidgin.im>
date Thu, 20 May 2004 00:14:14 +0000
parents f09801513729
children 6fd2bd5446e4
comparison
equal deleted inserted replaced
8981:e40f9afd420e 8982:a4fd6666bb83
137 sum = ((sum & 0xffff0000) >> 16) + (sum & 0x0000ffff); 137 sum = ((sum & 0xffff0000) >> 16) + (sum & 0x0000ffff);
138 138
139 return sum; 139 return sum;
140 } 140 }
141 141
142 faim_export int aim_util_getlocalip(fu8_t *ip)
143 {
144 struct hostent *hptr;
145 char localhost[129];
146
147 /* XXX if available, use getaddrinfo() */
148 /* XXX allow client to specify which IP to use for multihomed boxes */
149
150 if (gethostname(localhost, 128) < 0)
151 return -1;
152
153 if (!(hptr = gethostbyname(localhost)))
154 return -1;
155 memcpy(ip, hptr->h_addr_list[0], 4);
156
157 return 0;
158 }
159
160 /** 142 /**
161 * Check if the given screen name is a valid AIM screen name. 143 * Check if the given screen name is a valid AIM screen name.
162 * Example: BobDole 144 * Example: BobDole
163 * 145 *
164 * @return 1 if the screen name is valid, 0 if not. 146 * @return 1 if the screen name is valid, 0 if not.