Yattm - unified GTK instant-messaging client logo
   [Generated for version 0.2-17 - Mon Jan 6 19:01:23 GMT+1 2003]

Home - Main Page - Data Structures - File List - Data Fields - Globals

message_parse.h File Reference

#include <gtk/gtk.h>
#include "account.h"
#include "contact.h"
#include "service.h"

Include dependency graph for message_parse.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Functions

void eb_parse_incomming_message (eb_local_account *account, eb_account *remote, struct service *service, gchar *message)
void eb_update_status (eb_account *remote, gchar *message)

Variables

char filename [1024]


Function Documentation

void eb_parse_incomming_message eb_local_account   account,
eb_account   remote,
struct service   service,
gchar *    message
 

Definition at line 385 of file message_parse.c.

References DBG_CORE, eb_chat_window_display_remote_message(), eb_debug, filename, get_file(), get_local_addresses(), linkify(), RUN_SERVICE, send_file(), and xfer_in_progress.

00389 {
00390     char * buff;
00391     char * ptr;
00392     buff = strdup(message);
00393 
00394     ptr = strtok(buff," ");
00395 
00396     if(ptr && !strcmp(ptr, "EB_COMMAND") && !xfer_in_progress)
00397     {
00398         eb_debug(DBG_CORE, "EB_COMMAND received\n");
00399         ptr = strtok(NULL, " ");
00400         if(ptr && !strcmp(ptr, "SEND_FILE"))
00401         {
00402             char buff2[1024];
00403             char   myname[1024];
00404             int    s;
00405             struct sockaddr_in sa;
00406             struct hostent *hp;
00407 
00408             memset(&sa, 0, sizeof(struct sockaddr_in)); /* clear our address */
00409             gethostname(myname, 1023);           /* who are we? */
00410             hp= gethostbyname(myname);                  /* get our address info */
00411             if (hp == NULL) {                            /* we don't exist !? */
00412                 eb_debug(DBG_CORE, "gethostbyname failed: %s\n", strerror(errno));
00413                 free(buff);
00414                     return;
00415             }
00416             sa.sin_family= hp->h_addrtype;              /* this is our host address */
00417             sa.sin_port= htons(45678);                  /* this is our port number */
00418             if ((s= socket(AF_INET, SOCK_STREAM, 0)) < 0) { /* create socket */
00419                 eb_debug(DBG_CORE, "socket failed: %s\n", strerror(errno));
00420                 free(buff);
00421                     return;
00422             }
00423             if (bind(s,(struct sockaddr *)&sa,sizeof(struct sockaddr_in)) < 0) {
00424                 eb_debug(DBG_CORE, "bind failed: %s\n", strerror(errno));
00425                     close(s);
00426                 free(buff);
00427                 return;                               /* bind address to socket */
00428             }
00429             listen(s, 1);                               /* max # of queued connects */
00430             g_snprintf(buff2,1024,"EB_COMMAND ACCEPT %s", get_local_addresses());
00431             RUN_SERVICE(remote)->send_im(account,remote, buff2);
00432             get_file(s);
00433         }
00434         if(ptr && !strcmp(ptr, "ACCEPT"))
00435         {
00436             int sockfd;
00437             struct sockaddr_in dest_addr;
00438 
00439             ptr = strtok(NULL, " ");
00440             if(!ptr)
00441             {
00442                 free(buff);
00443                 return;
00444             }
00445 
00446             sockfd = socket(AF_INET, SOCK_STREAM, 0);
00447 
00448             dest_addr.sin_family = AF_INET;
00449             dest_addr.sin_port = htons(45678);
00450             dest_addr.sin_addr.s_addr = inet_addr(ptr);
00451             memset(&(dest_addr.sin_zero), 0, 8);
00452 
00453             connect(sockfd, (struct sockaddr *)&dest_addr, sizeof(struct sockaddr));
00454             send_file(filename, sockfd);
00455         }
00456     }
00457     else
00458     {
00459         gchar * message2 = linkify(message);
00460         eb_chat_window_display_remote_message( account, remote, serv, message2 );
00461         g_free(message2);
00462     }
00463     free(buff);
00464 }

void eb_update_status eb_account   remote,
gchar *    message
 

Definition at line 466 of file message_parse.c.

References eb_chat_window_display_status().

Referenced by buddy_update_status().

00468 {
00469         eb_chat_window_display_status( remote, message );
00470 }


Variable Documentation

char filename[1024]
 

Definition at line 50 of file message_parse.h.

Referenced by eb_parse_incomming_message(), and send_file().


Contact: Andy Maloney     [Documentation generated by doxygen]