Mercurial > pidgin
annotate src/network.c @ 780:c714def9cebb
[gaim-migrate @ 790]
You may be a geek if...
You've ever used a computer on Friday, Saturday and Sunday of the
same weekend.
You find yourself interrupting computer store salesman to correct
something he said.
The first thing you notice when walking in a business is their
computer system. ...and offer advice on how you would change it.
You've ever mounted a magnetic tape reel.
You own any shareware.
You know more IP addresses than phone numbers.
You've ever accidentally dialed an IP address.
Your friends use you as tech support.
You've ever named a computer.
You have your local computer store on speed dial.
You can't carry on a conversation without talking about computers.
Co-workers have to E-mail you about the fire alarm to get you out of
the building.
You've ever found "stray" diskettes when doing laundry.
Your computer has it's own phone line - but your teenager doesn't.
You check the national weather service web page for current weather
conditions (rather than look out the window).
You know more URLs than street addresses.
Your pet has a web page.
You get really excited when Yahoo adds your link.
committer: Tailor Script <tailor@pidgin.im>
| author | Eric Warmenhoven <eric@warmenhoven.org> |
|---|---|
| date | Tue, 29 Aug 2000 03:59:01 +0000 |
| parents | b402a23f35df |
| children | 56c7ceb986a8 |
| rev | line source |
|---|---|
| 1 | 1 /* |
| 2 * gaim | |
| 3 * | |
| 4 * Copyright (C) 1998-1999, Mark Spencer <markster@marko.net> | |
| 5 * | |
| 6 * This program is free software; you can redistribute it and/or modify | |
| 7 * it under the terms of the GNU General Public License as published by | |
| 8 * the Free Software Foundation; either version 2 of the License, or | |
| 9 * (at your option) any later version. | |
| 10 * | |
| 11 * This program is distributed in the hope that it will be useful, | |
| 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 14 * GNU General Public License for more details. | |
| 15 * | |
| 16 * You should have received a copy of the GNU General Public License | |
| 17 * along with this program; if not, write to the Free Software | |
| 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 19 * | |
| 20 */ | |
| 21 | |
|
349
b402a23f35df
[gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
26
diff
changeset
|
22 #ifdef HAVE_CONFIG_H |
|
b402a23f35df
[gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
26
diff
changeset
|
23 #include "../config.h" |
|
b402a23f35df
[gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
26
diff
changeset
|
24 #endif |
| 1 | 25 #include <netdb.h> |
| 26 #include <gtk/gtk.h> | |
| 27 #include <unistd.h> | |
| 28 #include <errno.h> | |
| 29 #include <netinet/in.h> | |
| 30 #include <arpa/inet.h> | |
| 31 #include <string.h> | |
| 32 #include <stdlib.h> | |
| 33 #include <stdio.h> | |
| 34 #include <time.h> | |
| 35 #include <sys/socket.h> | |
| 36 #include "gaim.h" | |
| 37 #include "proxy.h" | |
| 38 #include "gnome_applet_mgr.h" | |
| 39 | |
| 40 unsigned int *get_address(char *hostname) | |
| 41 { | |
| 42 struct hostent *hp; | |
| 43 unsigned int *sin=NULL; | |
| 44 if ((hp = proxy_gethostbyname(hostname))) { | |
| 45 sin = (unsigned int *)g_new0(struct sockaddr_in, 1); | |
| 46 memcpy(sin, hp->h_addr, hp->h_length); | |
| 47 } | |
| 48 return sin; | |
| 49 } | |
| 50 | |
| 51 int connect_address(unsigned int addy, unsigned short port) | |
| 52 { | |
| 53 int fd; | |
| 54 struct sockaddr_in sin; | |
| 55 | |
| 56 sin.sin_addr.s_addr = addy; | |
| 57 sin.sin_family = AF_INET; | |
| 58 sin.sin_port = htons(port); | |
| 59 | |
| 60 fd = socket(AF_INET, SOCK_STREAM, 0); | |
| 61 | |
| 62 if (fd > -1) { | |
| 26 | 63 if (quad_addr) |
| 64 g_free (quad_addr); | |
| 65 | |
| 66 quad_addr=g_strdup(inet_ntoa(sin.sin_addr)); | |
| 1 | 67 if (proxy_connect(fd, (struct sockaddr *)&sin, sizeof(sin)) > -1) { |
| 68 return fd; | |
| 69 } | |
| 70 } | |
| 71 return -1; | |
| 72 } | |
| 73 |
