diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/YahooGroups/src/commonheaders.h | 1 | ||||
-rw-r--r-- | plugins/YahooGroups/src/list.cpp | 4 | ||||
-rw-r--r-- | plugins/YahooGroups/src/list.h | 4 | ||||
-rw-r--r-- | plugins/YahooGroups/src/services.cpp | 43 |
4 files changed, 19 insertions, 33 deletions
diff --git a/plugins/YahooGroups/src/commonheaders.h b/plugins/YahooGroups/src/commonheaders.h index 61d51f6236..db316c3b18 100644 --- a/plugins/YahooGroups/src/commonheaders.h +++ b/plugins/YahooGroups/src/commonheaders.h @@ -34,6 +34,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include <m_options.h>
#include <m_protosvc.h>
#include <m_popup.h>
+#include <m_string.h>
#include <win2k.h>
#include "version.h"
diff --git a/plugins/YahooGroups/src/list.cpp b/plugins/YahooGroups/src/list.cpp index 364f468926..abfde10670 100644 --- a/plugins/YahooGroups/src/list.cpp +++ b/plugins/YahooGroups/src/list.cpp @@ -86,12 +86,12 @@ int CGroupsList::Count() return count;
}
-int CGroupsList::Contains(char *group)
+int CGroupsList::Contains(const char *group)
{
return (Index(group) >= 0);
}
-int CGroupsList::Index(char *group)
+int CGroupsList::Index(const char *group)
{
int i;
for (i = 0; i < count; i++)
diff --git a/plugins/YahooGroups/src/list.h b/plugins/YahooGroups/src/list.h index ef34699e7c..3414d8fdec 100644 --- a/plugins/YahooGroups/src/list.h +++ b/plugins/YahooGroups/src/list.h @@ -42,8 +42,8 @@ class CGroupsList int Count();
- int Contains(char *group);
- int Index(char *group);
+ int Contains(const char *group);
+ int Index(const char *group);
char *operator [](int index);
};
diff --git a/plugins/YahooGroups/src/services.cpp b/plugins/YahooGroups/src/services.cpp index a5a0b01cfd..f13cd473ff 100644 --- a/plugins/YahooGroups/src/services.cpp +++ b/plugins/YahooGroups/src/services.cpp @@ -87,7 +87,7 @@ int GetNextGroupIndex() return index - 1;
}
-void AddNewGroup(char *newGroup)
+void AddNewGroup(const char *newGroup)
{
int index = GetNextGroupIndex();
@@ -119,44 +119,29 @@ void CreateGroup(char *group) {
char *p = group;
char *sub = group;
- char buffer[1024] = {0};
-
+
+ CMStringA buf;
while ((p = strchr(sub, '\\')))
{
*p = 0;
- if (mir_strlen(buffer) > 0)
- {
- mir_strncat(buffer, "\\", SIZEOF(buffer) - mir_strlen(buffer));
- mir_strncat(buffer, sub, SIZEOF(buffer) - mir_strlen(buffer));
- }
- else{
- strncpy_s(buffer, sub, _TRUNCATE);
- }
+ if (!buf.IsEmpty())
+ buf.AppendChar('\\');
+ buf.Append(sub);
- if (!availableGroups.Contains(buffer))
- {
- AddNewGroup(buffer);
- }
+ if (!availableGroups.Contains(buf))
+ AddNewGroup(buf);
*p++ = '\\';
sub = p;
}
- if (sub)
- {
- if (mir_strlen(buffer) > 0)
- {
- mir_strncat(buffer, "\\", SIZEOF(buffer) - mir_strlen(buffer));
- mir_strncat(buffer, sub, SIZEOF(buffer) - mir_strlen(buffer));
- }
- else{
- strncpy_s(buffer, sub, _TRUNCATE);
- }
+ if (sub) {
+ if (!buf.IsEmpty())
+ buf.AppendChar('\\');
+ buf.Append(sub);
- if (!availableGroups.Contains(buffer))
- {
- AddNewGroup(buffer);
- }
+ if (!availableGroups.Contains(buf))
+ AddNewGroup(buf);
}
}
|