@@ -2388,88 +2388,97 @@ void CMUSHclientDoc::RecompileRegularExpressions ()
2388
2388
int iAliasErrors = 0 ;
2389
2389
#endif // ALIASES_USE_UTF8
2390
2390
2391
- POSITION pos;
2392
- CString strName;
2393
- CString strRegexp;
2391
+ CString sPluginName = " main world" ;
2394
2392
2395
- for (pos = GetTriggerMap ().GetStartPosition (); pos;)
2396
- {
2397
- CTrigger * pTrigger;
2398
- GetTriggerMap ().GetNextAssoc (pos, strName, pTrigger);
2393
+ if (m_CurrentPlugin)
2394
+ {
2395
+ sPluginName = " plugin " ;
2396
+ sPluginName += m_CurrentPlugin->m_strName ;
2397
+ }
2398
+
2399
+ POSITION pos;
2400
+ CString strName;
2401
+ CString strRegexp;
2399
2402
2400
- if (pTrigger->regexp )
2403
+ for (pos = GetTriggerMap ().GetStartPosition (); pos;)
2404
+ {
2405
+ CTrigger * pTrigger;
2406
+ GetTriggerMap ().GetNextAssoc (pos, strName, pTrigger);
2407
+
2408
+ if (pTrigger->regexp )
2409
+ {
2410
+ delete pTrigger->regexp ; // get rid of old one
2411
+ if (pTrigger->bRegexp )
2412
+ strRegexp = pTrigger->trigger ;
2413
+ else
2414
+ strRegexp = ConvertToRegularExpression (pTrigger->trigger );
2415
+ }
2416
+
2417
+ // compile regular expression
2418
+ try
2419
+ {
2420
+ pTrigger->regexp = regcomp (strRegexp, (pTrigger->ignore_case ? PCRE_CASELESS : 0 ) |
2421
+ (pTrigger->bMultiLine ? PCRE_MULTILINE : 0 ) |
2422
+ (m_bUTF_8 ? PCRE_UTF8 : 0 )
2423
+ );
2424
+ } // end of try
2425
+ catch (CException* e)
2401
2426
{
2402
- delete pTrigger->regexp ; // get rid of old one
2403
- if (pTrigger->bRegexp )
2404
- strRegexp = pTrigger->trigger ;
2405
- else
2406
- strRegexp = ConvertToRegularExpression (pTrigger->trigger );
2407
- }
2408
-
2409
- // compile regular expression
2410
- try
2411
- {
2412
- pTrigger->regexp = regcomp (strRegexp, (pTrigger->ignore_case ? PCRE_CASELESS : 0 ) |
2413
- (pTrigger->bMultiLine ? PCRE_MULTILINE : 0 ) |
2414
- (m_bUTF_8 ? PCRE_UTF8 : 0 )
2415
- );
2416
- } // end of try
2417
- catch (CException* e)
2418
- {
2419
- e->Delete ();
2420
- iTriggerErrors++;
2421
- pTrigger->regexp = NULL ;
2422
- } // end of catch
2423
- } // end of for each trigger
2427
+ e->Delete ();
2428
+ iTriggerErrors++;
2429
+ ColourNote (" red" , " " ,
2430
+ TFormat (" In %s, could not recompile trigger (%s) matching on: %s." ,
2431
+ (LPCTSTR) sPluginName , (LPCTSTR) pTrigger->strInternalName , (LPCTSTR) strRegexp));
2432
+ pTrigger->regexp = NULL ;
2433
+ } // end of catch
2434
+ } // end of for each trigger
2424
2435
2425
2436
#if ALIASES_USE_UTF8
2426
2437
2427
- for (pos = GetAliasMap ().GetStartPosition (); pos;)
2428
- {
2429
- CAlias * pAlias;
2430
- GetAliasMap ().GetNextAssoc (pos, strName, pAlias);
2438
+ for (pos = GetAliasMap ().GetStartPosition (); pos;)
2439
+ {
2440
+ CAlias * pAlias;
2441
+ GetAliasMap ().GetNextAssoc (pos, strName, pAlias);
2431
2442
2432
- if (pAlias->regexp )
2443
+ if (pAlias->regexp )
2444
+ {
2445
+ delete pAlias->regexp ; // get rid of old one
2446
+ if (pAlias->bRegexp )
2447
+ strRegexp = pAlias->name ;
2448
+ else
2449
+ strRegexp = ConvertToRegularExpression (pAlias->name );
2450
+ }
2451
+
2452
+ // compile regular expression
2453
+ try
2433
2454
{
2434
- delete pAlias->regexp ; // get rid of old one
2435
- if (pAlias->bRegexp )
2436
- strRegexp = pAlias->name ;
2437
- else
2438
- strRegexp = ConvertToRegularExpression (pAlias->name );
2439
- }
2440
-
2441
- // compile regular expression
2442
- try
2443
- {
2444
- pAlias->regexp = regcomp (strRegexp, (pAlias->bIgnoreCase ? PCRE_CASELESS : 0 ) |
2445
- (m_bUTF_8 ? PCRE_UTF8 : 0 )
2446
- );
2447
- } // end of try
2448
- catch (CException* e)
2449
- {
2450
- e->Delete ();
2451
- iAliasErrors++;
2452
- pAlias->regexp = NULL ;
2453
- } // end of catch
2454
- } // end of for each alias
2455
+ pAlias->regexp = regcomp (strRegexp, (pAlias->bIgnoreCase ? PCRE_CASELESS : 0 ) |
2456
+ (m_bUTF_8 ? PCRE_UTF8 : 0 )
2457
+ );
2458
+ } // end of try
2459
+ catch (CException* e)
2460
+ {
2461
+ e->Delete ();
2462
+ iAliasErrors++;
2463
+ ColourNote (" red" , " " ,
2464
+ TFormat (" In %s, could not recompile alias (%s) matching on: %s." ,
2465
+ (LPCTSTR) sPluginName , (LPCTSTR) pAlias->strInternalName , (LPCTSTR) strRegexp));
2466
+ pAlias->regexp = NULL ;
2467
+ } // end of catch
2468
+ } // end of for each alias
2455
2469
2456
2470
#endif // ALIASES_USE_UTF8
2457
2471
2458
- const char * sPluginName = " (Main world)" ;
2459
-
2460
- if (m_CurrentPlugin)
2461
- sPluginName = m_CurrentPlugin->m_strName ;
2462
-
2463
2472
if (iTriggerErrors)
2464
2473
ColourNote (" white" , " red" ,
2465
- TFormat (" In plugin %s, %i trigger(s) could not be recompiled." ,
2466
- sPluginName , iTriggerErrors));
2474
+ TFormat (" In %s, %i trigger(s) could not be recompiled." ,
2475
+ (LPCTSTR) sPluginName , iTriggerErrors));
2467
2476
2468
2477
#if ALIASES_USE_UTF8
2469
2478
if (iAliasErrors)
2470
2479
ColourNote (" white" , " red" ,
2471
- TFormat (" In plugin %s, %i alias(es) could not be recompiled." ,
2472
- sPluginName , iAliasErrors));
2480
+ TFormat (" In %s, %i alias(es) could not be recompiled." ,
2481
+ (LPCTSTR) sPluginName , iAliasErrors));
2473
2482
#endif // ALIASES_USE_UTF8
2474
2483
2475
2484
} // end of CMUSHclientDoc::RecompileRegularExpressions
0 commit comments