diff options
Diffstat (limited to 'protocols/Twitter/src')
| -rw-r--r-- | protocols/Twitter/src/chat.cpp | 86 | ||||
| -rw-r--r-- | protocols/Twitter/src/proto.cpp | 4 | 
2 files changed, 28 insertions, 62 deletions
diff --git a/protocols/Twitter/src/chat.cpp b/protocols/Twitter/src/chat.cpp index e657414295..cddcbcefca 100644 --- a/protocols/Twitter/src/chat.cpp +++ b/protocols/Twitter/src/chat.cpp @@ -22,16 +22,12 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  void TwitterProto::UpdateChat(const twitter_user &update)
  {
 -	GCDEST gcd = { m_szModuleName };
 -	gcd.ptszID = const_cast<TCHAR*>(m_tszUserName);
 -	gcd.iType  = GC_EVENT_MESSAGE;
 -
 -	GCEVENT gce  = {sizeof(gce)};
 -	gce.pDest    = &gcd;
 -	gce.dwFlags  = GC_TCHAR|GCEF_ADDTOLOG;
 -	gce.pDest    = &gcd;
 -	gce.ptszUID  = mir_a2t(update.username.c_str());
 -	gce.bIsMe    = (update.username == twit_.get_username());
 +	GCDEST gcd = { m_szModuleName, (TCHAR*)m_tszUserName, GC_EVENT_MESSAGE };
 +	GCEVENT gce = { sizeof(gce), &gcd };
 +	gce.pDest = &gcd;
 +	gce.bIsMe = (update.username == twit_.get_username());
 +	gce.dwFlags = GCEF_ADDTOLOG;
 +	gce.ptszUID = mir_a2t(update.username.c_str());
  	//TODO: write code here to replace % with %% in update.status.text (which is a std::string)
  	std::string chatText = update.status.text;
 @@ -93,18 +89,12 @@ int TwitterProto::OnChatOutgoing(WPARAM wParam,LPARAM lParam)  // TODO: remove nick?
  void TwitterProto::AddChatContact(const char *name,const char *nick)
  {
 -	GCDEST gcd = { m_szModuleName };
 -	gcd.ptszID = const_cast<TCHAR*>(m_tszUserName);
 -	gcd.iType  = GC_EVENT_JOIN;
 -
 -	GCEVENT gce    = {sizeof(gce)};
 -	gce.pDest      = &gcd;
 -	gce.dwFlags    = GC_TCHAR;
 -	gce.ptszNick   = mir_a2t(nick ? nick:name);
 -	gce.ptszUID    = mir_a2t(name);
 -	gce.bIsMe      = false;
 +	GCDEST gcd = { m_szModuleName, (TCHAR*)m_tszUserName, GC_EVENT_JOIN };
 +	GCEVENT gce = { sizeof(gce), &gcd };
 +	gce.time = DWORD(time(0));
 +	gce.ptszNick = mir_a2t(nick ? nick:name);
 +	gce.ptszUID = mir_a2t(name);
  	gce.ptszStatus = _T("Normal");
 -	gce.time       = static_cast<DWORD>(time(0));
  	CallServiceSync(MS_GC_EVENT,0,reinterpret_cast<LPARAM>(&gce));
  	mir_free(const_cast<TCHAR*>(gce.ptszNick));
 @@ -113,16 +103,11 @@ void TwitterProto::AddChatContact(const char *name,const char *nick)  void TwitterProto::DeleteChatContact(const char *name)
  {
 -	GCDEST gcd = { m_szModuleName };
 -	gcd.ptszID = const_cast<TCHAR*>(m_tszUserName);
 -	gcd.iType  = GC_EVENT_PART;
 -
 -	GCEVENT gce    = {sizeof(gce)};
 -	gce.pDest      = &gcd;
 -	gce.dwFlags    = GC_TCHAR;
 -	gce.ptszNick   = mir_a2t(name);
 -	gce.ptszUID    = gce.ptszNick;
 -	gce.time       = static_cast<DWORD>(time(0));
 +	GCDEST gcd = { m_szModuleName, (TCHAR*)m_tszUserName, GC_EVENT_PART };
 +	GCEVENT gce = { sizeof(gce), &gcd };
 +	gce.time = DWORD(time(0));
 +	gce.ptszNick = mir_a2t(name);
 +	gce.ptszUID = gce.ptszNick;
  	CallServiceSync(MS_GC_EVENT,0,reinterpret_cast<LPARAM>(&gce));
  	mir_free(const_cast<TCHAR*>(gce.ptszNick));
 @@ -130,28 +115,20 @@ void TwitterProto::DeleteChatContact(const char *name)  INT_PTR TwitterProto::OnJoinChat(WPARAM,LPARAM suppress)
  {
 -	GCSESSION gcw = {sizeof(gcw)};
 -
  	// ***** Create the group chat session
 -	gcw.dwFlags   = GC_TCHAR;
 -	gcw.iType     = GCW_CHATROOM;
 +	GCSESSION gcw = { sizeof(gcw) };
 +	gcw.iType = GCW_CHATROOM;
  	gcw.pszModule = m_szModuleName;
 -	gcw.ptszName  = m_tszUserName;
 -	gcw.ptszID    = m_tszUserName;
 +	gcw.ptszName = m_tszUserName;
 +	gcw.ptszID = m_tszUserName;
  	CallServiceSync(MS_GC_NEWSESSION, 0, (LPARAM)&gcw);
  	if(m_iStatus != ID_STATUS_ONLINE)
  		return 0;
  	// ***** Create a group
 -	GCDEST gcd = { m_szModuleName };
 -	gcd.ptszID = const_cast<TCHAR*>(m_tszUserName);
 -
 -	GCEVENT gce = {sizeof(gce)};
 -	gce.pDest = &gcd;
 -	gce.dwFlags = GC_TCHAR;
 -
 -	gcd.iType = GC_EVENT_ADDGROUP;
 +	GCDEST gcd = { m_szModuleName, (TCHAR*)m_tszUserName, GC_EVENT_ADDGROUP };
 +	GCEVENT gce = { sizeof(gce), &gcd };
  	gce.ptszStatus = _T("Normal");
  	CallServiceSync(MS_GC_EVENT,0,reinterpret_cast<LPARAM>(&gce));
 @@ -170,29 +147,18 @@ INT_PTR TwitterProto::OnLeaveChat(WPARAM,LPARAM)  {
  	in_chat_ = false;
 -	GCDEST gcd = { m_szModuleName };
 -	gcd.ptszID = const_cast<TCHAR*>(m_tszUserName);
 -	gcd.iType = GC_EVENT_CONTROL;
 -
 -	GCEVENT gce = {sizeof(gce)};
 -	gce.dwFlags = GC_TCHAR;
 -	gce.pDest = &gcd;
 +	GCDEST gcd = { m_szModuleName, (TCHAR*)m_tszUserName, GC_EVENT_CONTROL };
 +	GCEVENT gce = { sizeof(gce), &gcd };
  	CallServiceSync(MS_GC_EVENT,SESSION_OFFLINE,  reinterpret_cast<LPARAM>(&gce));
  	CallServiceSync(MS_GC_EVENT,SESSION_TERMINATE,reinterpret_cast<LPARAM>(&gce));
 -
  	return 0;
  }
  void TwitterProto::SetChatStatus(int status)
  {
 -	GCDEST gcd = { m_szModuleName };
 -	gcd.ptszID = const_cast<TCHAR*>(m_tszUserName);
 -	gcd.iType = GC_EVENT_CONTROL;
 -
 -	GCEVENT gce = {sizeof(gce)};
 -	gce.dwFlags = GC_TCHAR;
 -	gce.pDest = &gcd;
 +	GCDEST gcd = { m_szModuleName, (TCHAR*)m_tszUserName, GC_EVENT_CONTROL };
 +	GCEVENT gce = { sizeof(gce), &gcd };
  	if(status == ID_STATUS_ONLINE)
  	{
 diff --git a/protocols/Twitter/src/proto.cpp b/protocols/Twitter/src/proto.cpp index d90c67b6e1..35ca3af92f 100644 --- a/protocols/Twitter/src/proto.cpp +++ b/protocols/Twitter/src/proto.cpp @@ -374,9 +374,9 @@ int TwitterProto::OnModulesLoaded(WPARAM,LPARAM)  	twit_.set_handle(this, m_hNetlibUser);
 -	GCREGISTER gcr = {sizeof(gcr)};
 +	GCREGISTER gcr = { sizeof(gcr) };
  	gcr.pszModule = m_szModuleName;
 -	gcr.pszModuleDispName = m_szModuleName;
 +	gcr.ptszDispName = m_tszUserName;
  	gcr.iMaxText = 159;
  	CallService(MS_GC_REGISTER,0,reinterpret_cast<LPARAM>(&gcr));
  | 
