diff options
author | George Hazan <george.hazan@gmail.com> | 2013-04-09 20:03:46 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-04-09 20:03:46 +0000 |
commit | bcb27264ba737778e5d3edad36088bacf74f0236 (patch) | |
tree | fd1f57744dd380b7babe312a0ab5dc60b48854f2 /plugins/TabSRMM/src/trayicon.cpp | |
parent | 940231dc5a484b03a278900e1880aa083472b601 (diff) |
- short function names allows to write database loops in one string;
- 'continue' operator can be used then;
- multiple bugs fixed in clists;
- code becomes much more compact;
git-svn-id: http://svn.miranda-ng.org/main/trunk@4403 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/TabSRMM/src/trayicon.cpp')
-rw-r--r-- | plugins/TabSRMM/src/trayicon.cpp | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/plugins/TabSRMM/src/trayicon.cpp b/plugins/TabSRMM/src/trayicon.cpp index 212ba2d8b4..5739275cbb 100644 --- a/plugins/TabSRMM/src/trayicon.cpp +++ b/plugins/TabSRMM/src/trayicon.cpp @@ -330,39 +330,39 @@ typedef struct _recentEntry { void TSAPI LoadFavoritesAndRecent()
{
- RCENTRY *recentEntries, rceTemp;
DWORD dwRecent;
- int iIndex = 0, i, j;
- HANDLE hContact = db_find_first();
- recentEntries = new RCENTRY[nen_options.wMaxRecent + 1];
- if (recentEntries != NULL) {
- while (hContact != 0) {
- if (M->GetByte(hContact, SRMSGMOD_T, "isFavorite", 0))
- AddContactToFavorites(hContact, NULL, NULL, NULL, 0, 0, 1, PluginConfig.g_hMenuFavorites);
- if ((dwRecent = M->GetDword(hContact, "isRecent", 0)) != 0 && iIndex < nen_options.wMaxRecent) {
- recentEntries[iIndex].dwTimestamp = dwRecent;
- recentEntries[iIndex++].hContact = hContact;
- }
- hContact = db_find_next(hContact);
- }
- if (iIndex == 0) {
- free(recentEntries);
- return;
+ int iIndex = 0, i, j;
+
+ RCENTRY *recentEntries = new RCENTRY[nen_options.wMaxRecent + 1];
+ if (recentEntries == NULL)
+ return;
+
+ for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
+ if (M->GetByte(hContact, SRMSGMOD_T, "isFavorite", 0))
+ AddContactToFavorites(hContact, NULL, NULL, NULL, 0, 0, 1, PluginConfig.g_hMenuFavorites);
+ if ((dwRecent = M->GetDword(hContact, "isRecent", 0)) != 0 && iIndex < nen_options.wMaxRecent) {
+ recentEntries[iIndex].dwTimestamp = dwRecent;
+ recentEntries[iIndex++].hContact = hContact;
}
+ }
- for (i=0; i < iIndex - 1; i++) {
- for (j = 0; j < iIndex - 1; j++) {
- if (recentEntries[j].dwTimestamp > recentEntries[j+1].dwTimestamp) {
- rceTemp = recentEntries[j];
- recentEntries[j] = recentEntries[j+1];
- recentEntries[j+1] = rceTemp;
- }
+ if (iIndex == 0) {
+ free(recentEntries);
+ return;
+ }
+
+ for (i=0; i < iIndex - 1; i++) {
+ for (j = 0; j < iIndex - 1; j++) {
+ if (recentEntries[j].dwTimestamp > recentEntries[j+1].dwTimestamp) {
+ RCENTRY rceTemp = recentEntries[j];
+ recentEntries[j] = recentEntries[j+1];
+ recentEntries[j+1] = rceTemp;
}
}
- for (i=0; i < iIndex; i++)
- AddContactToFavorites(recentEntries[i].hContact, NULL, NULL, NULL, 0, 0, 1, PluginConfig.g_hMenuRecent);
-
- delete[] recentEntries;
}
+ for (i=0; i < iIndex; i++)
+ AddContactToFavorites(recentEntries[i].hContact, NULL, NULL, NULL, 0, 0, 1, PluginConfig.g_hMenuRecent);
+
+ delete[] recentEntries;
}
|