@@ -46,8 +46,8 @@ class WhatsProt
4646 const WHATSAPP_SERVER = 's.whatsapp.net ' ; // The hostname used to login/send messages.
4747 const WHATSAPP_UPLOAD_HOST = 'https://mms.whatsapp.net/client/iphone/upload.php ' ; // The upload host.
4848 const WHATSAPP_DEVICE = 'Android ' ; // The device name.
49- const WHATSAPP_VER = '2.11.471 ' ; // The WhatsApp version.
50- const WHATSAPP_USER_AGENT = 'WhatsApp/2.11.471 Android/4.3 Device/GalaxyS3 ' ; // User agent used in request/registration code.
49+ const WHATSAPP_VER = '2.11.473 ' ; // The WhatsApp version.
50+ const WHATSAPP_USER_AGENT = 'WhatsApp/2.11.473 Android/4.3 Device/GalaxyS3 ' ; // User agent used in request/registration code.
5151 const WHATSAPP_VER_CHECKER = 'https://coderus.openrepos.net/whitesoft/whatsapp_version ' ; // Check WhatsApp version
5252
5353 /**
@@ -3775,35 +3775,22 @@ protected function sendRequestFileUpload($b64hash, $type, $size, $filepath, $to,
37753775 */
37763776 protected function sendSetPicture ($ jid , $ filepath )
37773777 {
3778- if (stripos ($ filepath , 'http ' )!== false && !preg_match ('/\s/ ' ,$ filepath )){
3779- $ extension = end (explode (". " , $ filepath ));
3780- $ newImageName = rand (0 , 100000 );
3781- $ imagePath = static ::PICTURES_FOLDER ."/ " .$ newImageName .".jpg " ;
3782- if ($ extension == 'jpg ' ){
3783- copy ($ filepath , $ imagePath );
3784- $ filepath = $ imagePath ;
3785- }
3786- }
3787- preprocessProfilePicture ($ filepath );
3788- $ fp = @fopen ($ filepath , "r " );
3789- if ($ fp ) {
3790- $ data = fread ($ fp , filesize ($ filepath ));
3791- if ($ data ) {
3792- //this is where the fun starts
3793- $ picture = new ProtocolNode ("picture " , array ("type " => "image " ), null , $ data );
3794-
3795- $ hash = array ();
3796- $ nodeID = $ this ->createMsgId ("setphoto " );
3797- $ hash ["id " ] = $ nodeID ;
3798- $ hash ["to " ] = $ this ->getJID ($ jid );
3799- $ hash ["type " ] = "set " ;
3800- $ hash ["xmlns " ] = "w:profile:picture " ;
3801- $ node = new ProtocolNode ("iq " , $ hash , array ($ picture ), null );
3802-
3803- $ this ->sendNode ($ node );
3804- $ this ->waitForServer ($ nodeID );
3805- }
3806- }
3778+ $ data = preprocessProfilePicture ($ filepath );
3779+ $ preview = createIconGD ($ filepath , 96 , true );
3780+
3781+ $ picture = new ProtocolNode ("picture " , array ("type " => "image " ), null , $ data );
3782+ $ preview = new ProtocolNode ("picture " , array ("type " => "preview " ), null , $ preview );
3783+
3784+ $ hash = array ();
3785+ $ nodeID = $ this ->createMsgId ("setphoto " );
3786+ $ hash ["id " ] = $ nodeID ;
3787+ $ hash ["to " ] = $ this ->getJID ($ jid );
3788+ $ hash ["type " ] = "set " ;
3789+ $ hash ["xmlns " ] = "w:profile:picture " ;
3790+ $ node = new ProtocolNode ("iq " , $ hash , array ($ picture , $ preview ), null );
3791+
3792+ $ this ->sendNode ($ node );
3793+ $ this ->waitForServer ($ nodeID );
38073794 }
38083795 /**
38093796 * Parse the message text for emojis
0 commit comments