All pastes #417282 Raw Edit

shit

public cpp v1 · immutable
#417282 ·published 2007-03-30 19:46 UTC
rendered paste body
#include "yahoo.h"extern Config cfg;void yahoo_set_status(CStdString text) {  CStdString userid;  DWORD size;  int msgnum = (int)cfg["ymmsgnum"];  CStdString numstr;  numstr.Format("%d", msgnum);  HKEY yahoo;  LONG res;  CStdString userid_manual = cfg["ymuser"];  // manual mode & user is manually set  if((int)cfg["ymautouser"] == 0 && userid_manual.length() > 0) {    userid = userid_manual;  } else {    // get the user automatically from the registry    res = RegOpenKey(HKEY_CURRENT_USER, "Software\\Yahoo\\Pager", &yahoo);    if (res != ERROR_SUCCESS) return;    res = RegQueryValueEx(      yahoo,      "Yahoo! User ID",      NULL,      NULL,      (LPBYTE)userid.GetBuffer(MAX_PATH),      &size      );    if (res != ERROR_SUCCESS) {      RegCloseKey(yahoo);      return;    }    userid.ReleaseBuffer();  }  if(userid.length() == 0) return;    res = RegOpenKey(HKEY_CURRENT_USER, "Software\\Yahoo\\Pager\\profiles\\" + userid + "\\Custom Msgs", &yahoo);  if (res != ERROR_SUCCESS) return;    res = RegSetValueEx(yahoo, numstr.c_str(), NULL, REG_SZ, (LPBYTE)text.c_str(), text.length());    RegCloseKey(yahoo);  if (res != ERROR_SUCCESS) return;  HWND ya = FindWindow("YahooBuddyMain", NULL);  if (ya == NULL) return;  PostMessage (ya, 0x111, 0x188, 0);}