Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how check number client for chat #9

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions WhatsAppApi/Base/WhatsEventBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace WhatsAppApi
public class WhatsEventBase : ApiBase
{
//events
public event ExceptionDelegate OnDisconnect;
public event Action<Exception> OnDisconnect;
protected void fireOnDisconnect(Exception ex)
{
if (this.OnDisconnect != null)
Expand All @@ -19,7 +19,7 @@ protected void fireOnDisconnect(Exception ex)
}
}

public event NullDelegate OnConnectSuccess;
public event Action OnConnectSuccess;
protected void fireOnConnectSuccess()
{
if (this.OnConnectSuccess != null)
Expand All @@ -28,7 +28,7 @@ protected void fireOnConnectSuccess()
}
}

public event ExceptionDelegate OnConnectFailed;
public event Action<Exception> OnConnectFailed;
protected void fireOnConnectFailed(Exception ex)
{
if (this.OnConnectFailed != null)
Expand All @@ -46,7 +46,7 @@ protected void fireOnLoginSuccess(string pn, byte[] data)
}
}

public event StringDelegate OnLoginFailed;
public event Action<string> OnLoginFailed;
protected void fireOnLoginFailed(string data)
{
if (this.OnLoginFailed != null)
Expand Down Expand Up @@ -291,10 +291,7 @@ protected void fireOnGetGroupSubject(string gjid, string jid, string username, s

//event delegates
public delegate void OnContactNameDelegate(string from, string contactName);
public delegate void NullDelegate();
public delegate void ExceptionDelegate(Exception ex);
public delegate void LoginSuccessDelegate(string phoneNumber, byte[] data);
public delegate void StringDelegate(string data);
public delegate void OnErrorDelegate(string id, string from, int code, string text);
public delegate void OnGetMessageReceivedDelegate(string from, string id);
public delegate void OnNotificationPictureDelegate(string type, string jid, string id);
Expand Down
13 changes: 7 additions & 6 deletions WhatsAppApi/Settings/WhatsConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ public class WhatsConstants
/// <summary>
/// The whatsapp version the client complies to
/// </summary>
//public const string WhatsAppVer = "2.11.426";
public const string WhatsAppVer = "2.12.68";
public const string WhatsAppVer = "2.11.339";
//public const string WhatsAppVer = "2.12.68";

/// <summary>
/// The port that needs to be connected to
Expand All @@ -53,14 +53,15 @@ public class WhatsConstants
/// <summary>
/// iPhone device
/// </summary>
//public const string Device = "Android";
public const string Device = "S40";
public const string Device = "IPhone";
//public const string Device = "S40";

/// <summary>
/// The useragent used for http requests
/// </summary>
//public const string UserAgent = "WhatsApp/2.11.426 Android/4.0.4 Device/GalaxyS3";
public const string UserAgent = "WhatsApp/2.12.68 S40Version/14.26 Device/Nokia302";
public const string UserAgent = "WhatsApp/2.11.339 Apple-iPhone5C1/1001.525";
//public const string UserAgent = "WhatsApp/2.11.339 Android/4.0.4 Device/GalaxyS3";
//public const string UserAgent = "WhatsApp/2.12.68 S40Version/14.26 Device/Nokia302";

#endregion

Expand Down
2 changes: 1 addition & 1 deletion WhatsAppPort/WhatsMessageHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ private void CheckIfUserRegisteredAndCreate(FMessage mess)
return;

var jidSplit = mess.identifier_key.remote_jid.Split('@');
WhatsUser tmpWhatsUser = new WhatsUser(jidSplit[0], jidSplit[1], mess.identifier_key.serverNickname);
WhatsUser tmpWhatsUser = new WhatsUser(jidSplit[0], jidSplit[1], mess.identifier_key.serverName);
User tmpUser = new User(jidSplit[0], jidSplit[1]);
tmpUser.SetUser(tmpWhatsUser);

Expand Down