Refactor ProfAccount Structure into Smaller Components #81
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
The
ProfAccountstructure in account.h has grown to contain 34 fields covering multiple unrelated concerns. This violates the Single Responsibility Principle and makes the codebase harder to maintain and extend.Current State
The
ProfAccountstruct currently mixes:name,jid,password,eval_password,resourceserver,port,tls_policy,auth_policy,client,max_sessionslast_presence,login_presence,priority_online,priority_chat,priority_away,priority_xa,priority_dndmuc_service,muc_nickotr_policy,otr_manual,otr_opportunistic,otr_alwaysomemo_policy,omemo_enabled,omemo_disabledox_enabled,pgp_enabled,pgp_keyidenabled,startscript,themeVariant of refactoring
Split
ProfAccountinto smaller, focused sub-structures:Benefits
account_new()currently takes 33 parameters — sub-structures allow passing grouped configProfAccountEncryptionMigration Steps
account.haccount_new()signature to use builder pattern or sub-struct parametersaccount_free()to handle nested structuresaccounts.cto work with new structureaccount->accessors)account_encryption_free(),account_presence_init(), etc.Impact Assessment
account.c,accounts.c,cmd_funcs.c,xmpp/connection.c,xmpp/session.c, and othersLabels
refactoring,code-quality,breaking-change