Пример #1
0
static int snachandler(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs)
{

	if (snac->subtype == 0x0002)
		return infoupdate(sess, mod, rx, snac, bs);
	else if ((snac->subtype == 0x0003) || (snac->subtype == 0x0004))
		return userlistchange(sess, mod, rx, snac, bs);
	else if (snac->subtype == 0x0006)
		return incomingmsg(sess, mod, rx, snac, bs);

	return 0;
}
Пример #2
0
static int
snachandler(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs)
{
	if (snac->subtype == 0x0002)
		return infoupdate(od, conn, mod, frame, snac, bs);
	else if ((snac->subtype == 0x0003) || (snac->subtype == 0x0004))
		return userlistchange(od, conn, mod, frame, snac, bs);
	else if (snac->subtype == 0x0006)
		return incomingim_ch3(od, conn, mod, frame, snac, bs);

	return 0;
}
Пример #3
0
/* This is the main handler for messages received from the server */
void Server_Response( BYTE *data, DWORD len, WORD cmd, WORD ver, WORD seq, DWORD uin )
{
   SIMPLE_MESSAGE_PTR s_mesg;
   int i;
	 CONNECT_INFO random;
	 CONTACT_INFO *contact;
   USER_INFO user;
	 DWORD xuin;
   
   switch ( cmd )
   {
	   case SRV_ACK:
  	    Check_Queue( seq );
    	  break;
	   case SRV_MULTI_PACKET:
  	    Multi_Packet(  data );
    	  break;
	   case SRV_NEW_UIN:
				icq_callback(IM_NEWUIN,uin,0,0,0);
    	  break;
	   case SRV_UPDATE_FAIL:
				infoupdate(FAIL,IR_INFO);
    	  break;
	   case SRV_UPDATE_SUCCESS:
				infoupdate(SUCCESS,IR_INFO);
    	  break;
		 case SRV_AUTHORIZE_SUCCESS:
				infoupdate(SUCCESS,IR_AUTH);
				break;      
		 case SRV_AUTHORIZE_FAIL:
				infoupdate(FAIL,IR_AUTH);
				break;      
		 case SRV_UPDATE_EXT_SUCCESS:
				infoupdate(SUCCESS,IR_EXT);
				break;
		 case SRV_UPDATE_EXT_FAIL:
				infoupdate(FAIL,IR_EXT);
				break;
	   case SRV_LOGIN_REPLY:
      	snd_contact_list();
	      snd_invis_list();
  	    snd_vis_list();
				icq_callback(IM_LOGIN,0,0,0,0);
	      break;
  	 case SRV_X1: /* unknown message  sent after login*/
				icq_callback(IM_LOGIN2,0,0,0,0);
      	break;
	   case SRV_X2: /* unknown message  sent after login*/
  	    icq_snd_got_messages();
    	  break;
	   case SRV_GO_AWAY:
				icq_callback(IM_FORCEDDISCONNECT,0,0,0,0);
    	  break;
	   case SRV_END_OF_SEARCH:
				icq_callback(IM_SEARCHDONE,0,0,0,0);
    	  break;
	   case SRV_BAD_PASS:
				icq_callback(IM_BADPASS,0,0,0,0);
    	  break;
	   case SRV_TRY_AGAIN:
				icq_callback(IM_ACCOUNTBUSY,0,0,0,0);
    	  for ( i = 0; i< 1024; i++ )
      	{
        	 serv_mess[ i ]=FALSE;
  	    }
	      break;
	   case SRV_USER_OFFLINE:
				contact = FindContact(Chars_2_DW(&data[0]));
				if (!contact)
					return;
				icq_callback(IM_USEROFFLINE,0,contact,0,0);
	      contact->ci.status = STATUS_OFFLINE;
  	    contact->last_time = time( NULL );
      	break;
	   case SRV_USER_ONLINE:
				contact = FindContact(Chars_2_DW( &data[0] ));
				if (!contact)
					return;
				FillConnectInfo(&contact->ci,data);
				icq_callback(IM_USERONLINE,0,contact,0,0);
    	  break;
	   case SRV_STATUS_UPDATE:
				contact = FindContact(Chars_2_DW(&data[0]));
				if (!contact)
					return;
				contact->ci.status = GetStatusVal(Chars_2_DW(&data[4]));
				icq_callback(IM_STATUSUPDATE,0,contact,0,0);
    	  break;
	   case SRV_RAND_USER:
				if (len == 37) {
					FillConnectInfo(&random,data);
					icq_callback(IM_RANDRESPONSE,0,&random,0,0);
				}
				else
					icq_callback(IM_RANDRESPONSE,0,0,0,0);
      	break;
	   case SRV_USER_FOUND:
				FillUserInfo(&user,data);
				icq_callback(IM_USERFOUND,0,0,&user,0);
      	break;
	   case SRV_INFO_REPLY:
				HandleInfoReply(SUCCESS, UI_BASIC, data);
    	  break;
		 case SRV_INFO_NONE:
				HandleInfoReply(FAIL, UI_BASIC, data);
				break;
	   case SRV_EXT_INFO_REPLY:
				HandleInfoReply(SUCCESS, UI_EXTENDED, data);
    	  break;
		 case SRV_EXT_INFO_NONE:
				HandleInfoReply(FAIL, UI_EXTENDED, data);
				break;
	   case SRV_RECV_MESSAGE:
    	  Recv_Message(  data );
	      break;
  	 case SRV_SYS_DELIVERED_MESS:
    	  s_mesg = ( SIMPLE_MESSAGE_PTR ) data;
      	xuin = Chars_2_DW( s_mesg->uin );
      	Do_Msg(  Chars_2_Word( s_mesg->type ), Chars_2_Word( s_mesg->len ), 
           s_mesg->len + 2,xuin, 0, 0); 
	 			break;
	   default: /* commands we dont handle yet */
				 icq_callback(IM_UNHANDLED,cmd,data,(void *)len,0);
    	   break;
   }

}